Skip to content

Commit

Permalink
Configure Jest using Typescript
Browse files Browse the repository at this point in the history
This brings auto-completion to Jest configuration.

See: jestjs/jest#10564
See: jestjs/jest#9636 (comment)
  • Loading branch information
johnmartel committed Oct 28, 2020
1 parent 5b3f863 commit 06b579b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
5 changes: 4 additions & 1 deletion jest.config.js → jest.config.ts
@@ -1,4 +1,6 @@
module.exports = {
import type { Config } from '@jest/types';

const config: Config.InitialOptions = {
// this is a workaround since enabling coverage breaks sourceMaps
// See: https://github.com/kulshekhar/ts-jest/issues/917
// See: https://github.com/facebook/jest/issues/5739
Expand All @@ -18,3 +20,4 @@ module.exports = {
reporters: ['default', 'jest-junit'],
testEnvironment: 'node',
};
export default config;
31 changes: 31 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -27,6 +27,7 @@
"test:ci": "jest --coverage --ci"
},
"devDependencies": {
"@jest/types": "26.6.1",
"@types/jest": "26.0.15",
"@typescript-eslint/eslint-plugin": "2.34.0",
"@typescript-eslint/parser": "2.34.0",
Expand All @@ -40,6 +41,7 @@
"prettier": "2.1.2",
"rimraf": "3.0.2",
"ts-jest": "26.4.2",
"ts-node": "9.0.0",
"typescript": "4.0.3"
},
"dependencies": {
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Expand Up @@ -22,5 +22,8 @@
"include": [
"src/**/*"
],
"compileOnSave": true
"compileOnSave": true,
"tsNode": {
"compiler": "typescript"
}
}

0 comments on commit 06b579b

Please sign in to comment.