-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
35 lines (35 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
30
31
32
33
34
35
module.exports = {
roots: ['<rootDir>'],
collectCoverageFrom: [
'**/*.{js,jsx,ts,tsx}',
'!**/*.d.ts',
'!**/node_modules/**',
'!**/cypress/**',
],
setupFilesAfterEnv: ['<rootDir>/setupTests.ts'],
moduleFileExtensions: ['js', 'ts', 'tsx', 'json', 'css', 'scss'],
preset: 'ts-jest/presets/js-with-ts',
// https://github.com/zeit/next.js/issues/8663#issue-490553899
globals: {
// we must specify a custom tsconfig for tests because we need the typescript transform
// to transform jsx into js rather than leaving it jsx such as the next build requires. you
// can see this setting in tsconfig.jest.json -> "jsx": "react"
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.jest.json',
},
},
testPathIgnorePatterns: ['/node_modules/', '/.next/', '/cypress/'],
transformIgnorePatterns: [
'/node_modules/',
'[/\\\\]node_modules[/\\\\].+\\.(ts|tsx)$',
'^.+\\.module\\.(css|sass|scss)$',
],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': '<rootDir>/node_modules/babel-jest',
},
moduleNameMapper: {
'.(css|less|sass|scss)$': 'identity-obj-proxy',
'\\.(gif|ttf|eot|svg|png)$': '<rootDir>/test/__mocks__/fileMock.ts',
},
testEnvironment: 'jsdom',
};