Skip to content

Commit

Permalink
feat: added CI.yml
Browse files Browse the repository at this point in the history
still wip
  • Loading branch information
eddienubes committed Feb 10, 2024
1 parent e021cb4 commit 4587940
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 7 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ '16.x', '18.x', 20.x ]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- run: pnpm run lint:check
name: Lint Check

- run: pnpm run build:dev
name: Build Development

- run: pnpm run test:all
name: Test All



9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "0.0.1",
"description": "A simple, fast, and easy to use HTTP server testing library",
"type": "module",
"engines": {
"node": ">=16.5.0"
},
"exports": {
".": {
"import": "./build/esm/index.js",
Expand All @@ -16,9 +19,10 @@
"scripts": {
"test:all": "pnpm vitest run",
"test:watch": "pnpm vitest watch",
"benchmark": "pnpm vitest bench",
"build:dev": "tsc -p tsconfig.json",
"build:prod": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json"
"build:prod": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json",
"lint:check": "eslint --max-warnings=50 .",
"lint:fix": "eslint --max-warnings=50 --fix ."
},
"keywords": [],
"author": "eddienubes",
Expand All @@ -35,6 +39,7 @@
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"@vitest/coverage-v8": "^1.2.2",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
Expand Down
184 changes: 184 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './polyfill.js';
import {
DeepPartial,
HttpCallable,
Expand Down
8 changes: 8 additions & 0 deletions src/polyfill.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ReadableStream, WritableStream } from 'node:stream/web';

// For NodeJS 16 support
// Unfortunatelly, NodeJS 16 does not support ReadableStream and WritableStream in global scope
// @ts-expect-error
globalThis.ReadableStream = ReadableStream;
// @ts-expect-error
globalThis.WritableStream = WritableStream;
1 change: 1 addition & 0 deletions test/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../src/polyfill.js';
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"outDir": "build",
"noEmit": false,
"noEmit": true,
"experimentalDecorators": true,
"incremental": true,
"module": "NodeNext",
Expand Down
5 changes: 2 additions & 3 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ export default defineConfig({
globals: true,
reporters: ['verbose'],
disableConsoleIntercept: true,
benchmark: {

}
setupFiles: ['test/setup.ts'],
include: ['test/**/*.spec.ts']
}
});

0 comments on commit 4587940

Please sign in to comment.