-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.cjs
44 lines (42 loc) · 1.19 KB
/
jest.config.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const fs = require("node:fs");
const swcConfig = JSON.parse(fs.readFileSync(`${__dirname}/.swcrc`, "utf-8"));
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
testEnvironment: "node",
moduleFileExtensions: ["js", "json", "ts"],
transform: {
"^.+\\.(t|j)sx?$": [
"@swc/jest",
{
...swcConfig,
/* custom configuration in Jest */
jsc: {
...(swcConfig.jsc ?? {}),
experimental: {
...(swcConfig.jsc?.experimental ?? {}),
plugins: [
...(swcConfig.jsc?.experimental?.plugins ?? []),
[
"@swc/plugin-transform-imports",
{
"^(.*?)(\\.js)$": {
skipDefaultConversion: true,
// remove js suffix from local imports:
transform: "{{matches.[1]}}",
},
},
],
],
},
},
},
],
},
extensionsToTreatAsEsm: [".ts", ".tsx"],
setupFiles: ["<rootDir>/jest-setup.mjs"],
testMatch: ["**/*.spec.js", "**/*.spec.ts"],
resetMocks: true,
maxWorkers: 1,
logHeapUsage: true,
forceExit: true,
};