-
Notifications
You must be signed in to change notification settings - Fork 921
/
jest.config.js
33 lines (30 loc) · 1.13 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
const fs = require('fs');
const path = require('path');
// Use this instead of `paths.testsSetup` to avoid putting
// an absolute filename into configuration after ejecting.
// const setupTestsFile = fs.existsSync(paths.testsSetup)
// ? `<rootDir>/src/setupTests.js`
// : undefined;
const setupTestsFile = true;
module.exports = function () {
return {
verbose: true,
setupFiles: [require.resolve('react-app-polyfill/jsdom')],
setupFilesAfterEnv: setupTestsFile ? ['<rootDir>/jest.setup.js'] : [],
testMatch: [
'<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}',
'<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}',
],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': path.resolve(__dirname, 'jest/babelTransform.js'),
'^.+\\.css$': path.resolve(__dirname, 'jest/cssTransform.js'),
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': path.resolve(__dirname, 'jest/fileTransform.js'),
},
transformIgnorePatterns: ['node_modules'],
testEnvironment: 'jsdom',
// transformIgnorePatterns: [
// "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
// "^.+\\.module\\.(css|sass|scss)$",
// ],
};
};