diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5825feb2..dd733b8b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,6 +26,7 @@ jobs: ${{ runner.os }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} - run: npm ci - run: npm run lint + - run: npm run typecheck test: if: "!contains(github.event.head_commit.message, 'skip ci')" diff --git a/package.json b/package.json index 24223a8d..20b1475b 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "test": "jest", "build": "rimraf lib && tsc --project ./tsconfig.json", "watch": "npm run build -- --watch", + "typecheck": "tsc --noEmit --project tsconfig.test.json --noEmit", "lint": "prettier --check ." }, "files": [ @@ -68,7 +69,12 @@ "jest": { "preset": "ts-jest", "testEnvironment": "node", - "rootDir": "./src" + "rootDir": "./src", + "globals": { + "ts-jest": { + "tsconfig": "./tsconfig.test.json" + } + } }, "engines": { "node": ">= 10.0.0" diff --git a/tsconfig.json b/tsconfig.json index cc3d4442..0a83f51e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,7 @@ "rootDir": "src", "sourceMap": true, "target": "ES6", - "types": ["node", "jest"] + "types": ["node"] }, "typeRoots": ["node_modules/@types"], "exclude": [ @@ -17,6 +17,5 @@ "lib", "src/**/__mocks__/*.ts", "src/**/__tests__/*.ts" - ], - "include": ["src/**/*.ts"] + ] } diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 00000000..45a73a4d --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { "noEmit": true, "types": ["node", "jest"] }, + "exclude": ["node_modules"], + "include": ["src/**/__mocks__/*.ts", "src/**/__tests__/*.ts"] +}