Skip to content

Commit 0eacf4b

Browse files
authored
test: migrate config file to TypeScript (#324)
1 parent 5bdfc57 commit 0eacf4b

File tree

5 files changed

+178
-202
lines changed

5 files changed

+178
-202
lines changed

.eslintrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"plugins": ["jest", "simple-import-sort"],
99
"settings": {
1010
"node": {
11+
"allowModules": ["@jest/types"],
1112
"tryExtensions": [".ts", ".js", ".json", ".node"]
1213
}
1314
},

jest.config.js jest.config.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/** @type {import('@jest/types/build/Config').InitialOptions} */
2-
module.exports = {
1+
import type { Config } from '@jest/types'
2+
3+
const config: Config.InitialOptions = {
34
clearMocks: true,
45
moduleFileExtensions: ['js', 'ts'],
56
testEnvironment: 'node',
@@ -11,3 +12,4 @@ module.exports = {
1112
collectCoverage: true,
1213
collectCoverageFrom: ['<rootDir>/src/**/*.ts']
1314
}
15+
export default config

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"npm-run-all": "^4.1.5",
6363
"prettier": "^2.1.2",
6464
"ts-jest": "^26.4.3",
65+
"ts-node": "^9.0.0",
6566
"typescript": "^4.0.5"
6667
}
6768
}

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"noImplicitAny": true,
99
"esModuleInterop": true
1010
},
11-
"exclude": ["node_modules", "__tests__"],
11+
"exclude": ["node_modules", "__tests__", "jest.config.ts"],
1212
"types": ["jest", "js-yaml", "node"]
1313
}

0 commit comments

Comments
 (0)