Skip to content

Commit 20adb42

Browse files
authored
refactor: write jest config in ts (#485)
* refactor: write jest config in ts Signed-off-by: Rui Chen <[email protected]> * chore: exclude jest.config.ts in tsconfig Signed-off-by: Rui Chen <[email protected]> * chore: run build Signed-off-by: Rui Chen <[email protected]> --------- Signed-off-by: Rui Chen <[email protected]>
1 parent f808f15 commit 20adb42

6 files changed

+176
-20
lines changed

dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jest.config.js

-11
This file was deleted.

jest.config.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { JestConfigWithTsJest } from 'ts-jest';
2+
3+
const config: JestConfigWithTsJest = {
4+
preset: 'ts-jest/presets/default-esm',
5+
clearMocks: true,
6+
moduleFileExtensions: ['js', 'ts'],
7+
testEnvironment: 'node',
8+
testMatch: ['**/*.test.ts'],
9+
testRunner: 'jest-circus/runner',
10+
transform: {
11+
'^.+\\.ts$': 'ts-jest',
12+
},
13+
verbose: true,
14+
};
15+
16+
export default config;

package-lock.json

+155-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"jest": "^29.3.1",
3838
"jest-circus": "^29.3.1",
3939
"prettier": "3.3.3",
40-
"ts-jest": "^29.2.2",
40+
"ts-jest": "^29.2.3",
41+
"ts-node": "^10.9.2",
4142
"typescript": "^5.5.3",
4243
"typescript-formatter": "^7.2.2"
4344
}

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@
6060
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
6161
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
6262
},
63-
"exclude": ["node_modules", "**/*.test.ts"]
64-
}
63+
"exclude": ["node_modules", "**/*.test.ts", "jest.config.ts"]
64+
}

0 commit comments

Comments
 (0)