-
Notifications
You must be signed in to change notification settings - Fork 17
/
jest.config.ts
61 lines (50 loc) · 1.61 KB
/
jest.config.ts
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/
import type { Config } from "jest";
const config: Config = {
collectCoverage: true,
coverageDirectory: "coverage",
coverageProvider: "v8",
moduleFileExtensions: ["js", "ts", "json"],
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1", // Transforms requires of ./src/x.js -> ./src/x
},
resetModules: true,
rootDir: "src",
setupFiles: ["../jest.presetup.ts"],
setupFilesAfterEnv: ["../jest.setup.ts"],
testEnvironment: "node",
testTimeout: 15 * 1000, // 15 second timeout per test
transform: {
"^.+\\.(t|j)sx?$": [
"@swc/jest",
{
$schema: "https://swc.rs/schema.json",
jsc: {
baseUrl: "./src",
parser: {
syntax: "typescript",
decorators: true,
},
transform: {
decoratorMetadata: true,
legacyDecorator: true,
},
target: "esnext",
experimental: {
plugins: [["swc_mut_cjs_exports", {}]],
},
},
},
],
},
verbose: true,
extensionsToTreatAsEsm: [".ts", ".tsx"],
};
/* CI specific config */
if (process.env.CI != undefined && process.env.CI != "0" && process.env.CI != "") {
config.reporters = [["github-actions", { silent: false }], "summary"];
}
export default config;