-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
29 lines (26 loc) · 1.19 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
// Jest.config.js
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: "./"
});
// Jest.config.js
const customConfig = {
// Automatically clear mock calls and instances between every test
"clearMocks": true,
// The directory where Jest should output its coverage files
"coverageDirectory": ".coverage",
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
moduleNameMapper: {
"^@/components(.*)$": "<rootDir>/src/components$1"
},
// A list of paths to modules that run some code to configure or set up the testing framework before each test
"setupFilesAfterEnv": ["./jest.setup.js"],
// By default jest will use a node environment, so DOM elements (like document) will be undefined without this
"testEnvironment": "jsdom",
// Collect coverage with Jest Sonar Reporter
collectCoverage: true,
collectCoverageFrom: ["src/**/*.{ts,tsx}"],
testResultsProcessor: "jest-sonar-reporter",
};
module.exports = createJestConfig(customConfig);