2024-08-24 06:33:10 +08:00
|
|
|
/**
|
|
|
|
* @type {import('jest').Config}
|
|
|
|
*/
|
|
|
|
const jestConfig = {
|
2023-07-25 04:20:23 +08:00
|
|
|
testMatch: ["**/*.test.ts"],
|
|
|
|
testEnvironment: "node",
|
2023-07-25 05:08:07 +08:00
|
|
|
extensionsToTreatAsEsm: [".ts", ".tsx", ".jsx"],
|
2023-07-25 04:20:23 +08:00
|
|
|
transformIgnorePatterns: [], // transform node_modules
|
2023-05-25 14:48:26 +08:00
|
|
|
transform: {
|
2023-07-25 04:20:39 +08:00
|
|
|
"^.+\\.(t|j)sx?$": "@swc/jest",
|
2023-05-25 14:48:26 +08:00
|
|
|
},
|
2024-08-16 08:12:29 +08:00
|
|
|
// resolve js files from ts files
|
|
|
|
moduleNameMapper: {
|
|
|
|
"(.+)\\.js": "$1",
|
|
|
|
},
|
2021-09-14 16:18:36 +08:00
|
|
|
// coverage
|
2023-07-25 04:20:39 +08:00
|
|
|
collectCoverageFrom: ["src/**/*.{ts,tsx,js,jsx}"],
|
2021-09-14 16:18:36 +08:00
|
|
|
coveragePathIgnorePatterns: ["assets", ".css.d.ts"],
|
|
|
|
verbose: true,
|
|
|
|
}
|
2023-05-25 14:48:26 +08:00
|
|
|
|
|
|
|
export default jestConfig
|