-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathjest.config.js
35 lines (30 loc) · 948 Bytes
/
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
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: "./packages/site",
});
// Add any custom config to be passed to Jest
const customJestConfig = {
watchPathIgnorePatterns: "/target/debug/",
testEnvironment: "jest-environment-jsdom",
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
};
// https://github.com/vercel/next.js/discussions/34589
module.exports = async () => {
const nextJestConfig = await createJestConfig(customJestConfig)();
const esmPatterns = [
"got",
"p-cancelable",
"@szmarczak/http-timer",
"lowercase-keys",
];
return {
...nextJestConfig,
transformIgnorePatterns: [
`/node_modules/(?!(${esmPatterns.join("|")})/)`,
...nextJestConfig.transformIgnorePatterns.filter(
(pattern) => pattern !== "/node_modules/"
),
],
};
};