-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
33 lines (30 loc) · 1.16 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
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/no-var-requires */
const nextJest = require('next/jest');
// @ts-ignore - Provide the path to load next.config.js and .env files
const createJestConfig = nextJest({ dir: './' });
/**
* Add any custom config to be passed to Jest - https://jestjs.io/docs/en/configuration.html
* @type {import('jest').Config}
*/
const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
moduleNameMapper: {
// Handle module aliases (this will be automatically configured for you soon)
'^@/components/(.*)$': '<rootDir>/components/$1',
'^@/pages/(.*)$': '<rootDir>/pages/$1',
},
testEnvironment: 'jest-environment-jsdom',
testPathIgnorePatterns: ['/tests/'], // these are e2e tests, ignore them
collectCoverage: true,
coverageThreshold: {
global: {
lines: 80,
statements: 80,
branches: 80,
functions: 80,
},
},
};
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(customJestConfig);