diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b624161 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: Test +on: [push, pull_request] +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: npm + + - name: Install Dependencies + run: npm ci + + - name: Run Unit Tests + run: npm test diff --git a/package.json b/package.json index 18e009a..95a538f 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "build:microbundle": "microbundle -o dist/index.js -f modern,umd --globals react=React,react-dom=ReactDOM --jsx React.createElement --jsxFragment React.Fragment --no-compress --tsconfig tsconfig.build.json", "start:microbundle": "microbundle watch -o dist/index.js -f modern,umd --globals react=React,react-dom=ReactDOM --jsx React.createElement --jsxFragment React.Fragment --no-compress --tsconfig tsconfig.build.json", "test:linter": "eslint 'src/**/*.{ts,tsx}'", - "test:tsc": "tsc --project tsconfig.json --noEmit", + "test:tsc": "tsc --project tsconfig.test.json --noEmit", "test:prettier": "prettier --check ./src ./examples", "test:unit": "jest", "test": "npm-run-all -p test:linter test:prettier test:tsc -s test:unit", diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 0000000..4402d6c --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["./examples"], + "compilerOptions": { + "noEmit": false + } +}