forked from sofn-xyz/mailing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
58 lines (51 loc) · 1.6 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
import type { Config } from "jest";
let config: Config;
const shared = {
setupFilesAfterEnv: ["<rootDir>/testSetup.ts"],
};
if (process.env.NEXT_CLI_TESTS) {
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/cli",
});
// Add any custom config to be passed to Jest
const customJestConfig = {
...shared,
testEnvironment: "jest-environment-jsdom",
testMatch: [
"<rootDir>/packages/cli/src/pages/**/__test__/**/*.[jt]s?(x)",
"<rootDir>/packages/cli/src/components/**/__test__/**/*.[jt]s?(x)",
],
};
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
config = createJestConfig(customJestConfig);
} else {
config = {
...shared,
preset: "ts-jest",
testEnvironment: "node",
// TODO: keep testTimeout low and use jest.setTimeout for long ones
testTimeout: 60000,
transform: {
"^.+\\.(ts|tsx)$": "ts-jest",
"^.+\\.(js)$": "babel-jest",
},
testPathIgnorePatterns: [
"scripts",
"<rootDir>/emails/",
"<rootDir>/.mailing/",
"<rootDir>/packages/cli/.mailing/",
"<rootDir>/packages/cli/src/pages",
"<rootDir>/packages/cli/src/components",
],
watchPathIgnorePatterns: [
"<rootDir>/emails/",
"<rootDir>/packages/cli/src/emails/",
"<rootDir>/packages/cli/src/generator_templates/ts/emails/",
"<rootDir>/.mailing/",
"tmp-testMailQueue.json",
],
};
}
export default config;