Skip to content

Commit

Permalink
Merge pull request #113 from tancredi/test-ts-config
Browse files Browse the repository at this point in the history
Type-checking on CI, separate testing TS project
  • Loading branch information
tancredi authored Feb 8, 2021
2 parents 9960550 + f0a55aa commit a6c5b91
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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')"
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
"rootDir": "src",
"sourceMap": true,
"target": "ES6",
"types": ["node", "jest"]
"types": ["node"]
},
"typeRoots": ["node_modules/@types"],
"exclude": [
"node_modules",
"lib",
"src/**/__mocks__/*.ts",
"src/**/__tests__/*.ts"
],
"include": ["src/**/*.ts"]
]
}
6 changes: 6 additions & 0 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": { "noEmit": true, "types": ["node", "jest"] },
"exclude": ["node_modules"],
"include": ["src/**/__mocks__/*.ts", "src/**/__tests__/*.ts"]
}

0 comments on commit a6c5b91

Please sign in to comment.