-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjest.config.js
25 lines (22 loc) · 1013 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
// 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'
}
module.exports = createJestConfig(customConfig)