-
Notifications
You must be signed in to change notification settings - Fork 0
/
craco.config.js
74 lines (71 loc) · 2.13 KB
/
craco.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
webpack: {
configure: (webpackConfig, { env, paths }) => {
const copyWebPackPlugin = new CopyWebpackPlugin({
patterns: [
// Copy icon to build folder
{
from: path.resolve(__dirname, 'src/assets/icon.*'),
to: path.resolve(__dirname, 'build/[name][ext]'),
},
// Copy background to build folder
{
from: path.resolve(__dirname, 'src/assets/background.*'),
to: path.resolve(__dirname, 'build/[name][ext]'),
},
],
});
webpackConfig.plugins = [...webpackConfig.plugins, copyWebPackPlugin];
return webpackConfig;
},
},
jest: {
configure: (jestConfig, { env, paths, resolve, rootDir }) => {
jestConfig.roots = ['.'];
jestConfig.setupFilesAfterEnv = ['./src/setupTests.ts'];
jestConfig.testMatch = [
'**/__tests__/**/*.{ts,tsx}',
'**/*.{spec,test}.{ts,tsx}',
'!**/__tests__/**/*.cypress.{ts,tsx}',
];
//FIXME: Revert the code coverage limits (70, 80, 80, 80)
jestConfig.coverageThreshold = {
global: {
branches: 50,
functions: 50,
lines: 80,
statements: 80,
},
};
jestConfig.collectCoverageFrom = [
'src/**/*.{ts,tsx}',
'!src/index.tsx',
'!src/testing/*',
'!src/store/hooks.ts',
'!src/**/*.cypress.{ts,tsx}',
'!src/**/*.d.ts',
];
jestConfig.projects = [
{
displayName: 'Unit',
testPathIgnorePatterns: ['/node_modules/', '/e2e/'],
testMatch: [
'<rootDir>/src/**/__tests__/**/*.{ts,tsx}',
'<rootDir>/src/**/*.{spec,test}.{ts,tsx}',
],
},
{
displayName: 'E2E',
testPathIgnorePatterns: ['/node_modules/', '/src/'],
testMatch: [
'<rootDir>/e2e/**/__tests__/**/*.{ts,tsx}',
'<rootDir>/e2e/**/*.{spec,test}.{ts,tsx}',
],
},
];
return jestConfig;
},
},
};