-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.cjs
51 lines (51 loc) · 1.68 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
45
46
47
48
49
50
51
module.exports = {
globals: {
"globalThis.__DEV__": JSON.stringify(true),
},
moduleNameMapper: {
"\\.svg": "<rootDir>/src/__tests__/mocks/svg.js",
},
extensionsToTreatAsEsm: [".ts", ".tsx"],
testEnvironment: "jsdom",
roots: ["<rootDir>/src/__tests__"],
testPathIgnorePatterns: [
"<rootDir>/src/__tests__/mocks",
"<rootDir>/.storybook",
"<rootDir>/dist",
],
setupFiles: ["./jest.polyfills.js"],
setupFilesAfterEnv: ["<rootDir>/setupTests.ts"],
preset: "ts-jest/presets/default-esm",
// Opt out of the browser export condition for MSW tests
// for more information, see: https://github.com/mswjs/msw/issues/1786#issuecomment-1782559851
testEnvironmentOptions: {
customExportConditions: [""],
},
collectCoverageFrom: [
"src/**/*.ts",
"!src/__tests__/**/*.ts",
"!src/requestHandler.ts",
],
coverageReporters: ["html", "json-summary", "text", "text-summary"],
reporters: ["default", ["jest-junit", { outputDirectory: "coverage" }]],
transform: {
"\\.(gql|graphql)$": "@graphql-tools/jest-transform",
"^.+\\.tsx?$": [
"ts-jest",
{
useESM: true,
// Note: We shouldn't need to include `isolatedModules` here because
// it's a deprecated config option in TS 5, but setting it to `true`
// fixes the `ESM syntax is not allowed in a CommonJS module when
// 'verbatimModuleSyntax' is enabled` error that we're seeing when
// running our Jest tests.
// See https://github.com/kulshekhar/ts-jest/issues/4081
isolatedModules: true,
diagnostics: {
warnOnly: process.env.TEST_ENV !== "ci",
},
},
],
},
resolver: "ts-jest-resolver",
};