-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
36 lines (33 loc) · 1.22 KB
/
jest.config.js
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
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
const nextJest = require("next/jest");
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: "./",
});
/** @type {import('ts-jest').JestConfigWithTsJest} */
const customJestConfig = {
// Add more setup options before each test is run
// setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
// preset: 'ts-jest/presets/default-esm',
extensionsToTreatAsEsm: ['.ts'],
setupFilesAfterEnv: ["<rootDir>/setupTests.ts"],
transform: {
".+\\.(css|styl|less|sass|scss)$": "jest-css-modules-transform",
},
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/$1",
},
globals: {
"ts-jest": "tsconfig.test.json",
},
testEnvironment: "jest-environment-jsdom",
};
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = async () => ({
...(await createJestConfig(customJestConfig)()),
transformIgnorePatterns: [
// The regex below is just a guess, you might tweak it
'node_modules/(?!(yaml|@(react-hook|juggle)\/.*|tabbable|focus-trap|tslib|@patternfly-labs\/.*|@patternfly\/.*)/)',
]
})