forked from strapi/strapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.front.js
85 lines (80 loc) · 2.79 KB
/
jest.config.front.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
75
76
77
78
79
80
81
82
83
84
85
const IS_EE = process.env.IS_EE === 'true';
const moduleNameMapper = {
'.*\\.(css|less|styl|scss|sass)$': '<rootDir>/test/config/front/mocks/cssModule.js',
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
'<rootDir>/test/config/front/mocks/image.js',
'^ee_else_ce(/.*)$': [
'<rootDir>/packages/core/admin/admin/src$1',
'<rootDir>/packages/core/content-manager/admin/src$1',
'<rootDir>/packages/core/content-type-builder/admin/src$1',
'<rootDir>/packages/core/upload/admin/src$1',
'<rootDir>/packages/core/email/admin/src$1',
'<rootDir>/packages/plugins/*/admin/src$1',
],
};
if (IS_EE) {
const rootDirEE = [
'<rootDir>/packages/core/admin/ee/admin$1',
'<rootDir>/packages/core/content-manager/ee/admin/src$1',
'<rootDir>/packages/core/content-type-builder/ee/admin/src$1',
'<rootDir>/packages/core/upload/ee/admin/src$1',
'<rootDir>/packages/core/email/ee/admin/src$1',
'<rootDir>/packages/plugins/*/ee/admin/src$1',
];
Object.assign(moduleNameMapper, {
'^ee_else_ce(/.*)$': rootDirEE,
});
}
module.exports = {
collectCoverageFrom: [
'packages/core/*/admin/src/**/*.js',
'packages/plugins/*/admin/src/**/*.js',
],
globals: {
__webpack_public_path__: 'http://localhost:4000',
strapi: {
backendURL: 'http://localhost:1337',
isEE: false,
features: [],
projectType: 'Community',
},
BACKEND_URL: 'http://localhost:1337',
ADMIN_PATH: '/admin',
NODE_ENV: 'test',
// FIXME create a clean config file
},
moduleDirectories: [
'node_modules',
'<rootDir>/packages/strapi-admin/node_modules',
'<rootDir>/test/config/front',
],
moduleNameMapper,
rootDir: process.cwd(),
setupFiles: [
'<rootDir>/test/config/front/test-bundler.js',
'<rootDir>/packages/admin-test-utils/lib/mocks/LocalStorageMock.js',
'<rootDir>/packages/admin-test-utils/lib/mocks/IntersectionObserver.js',
'<rootDir>/packages/admin-test-utils/lib/mocks/ResizeObserver.js',
],
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/examples/getstarted/',
'<rootDir>/examples/kitchensink/',
'<rootDir>/packages/strapi-helper-plugin/dist/',
'/OLD/',
'__tests__',
],
setupFilesAfterEnv: [
'<rootDir>/test/config/front/enzyme-setup.js',
'<rootDir>/test/config/front/strapi.js',
],
testRegex: 'tests/.*\\.test\\.js$',
transform: {
'^.+\\.js$': ['@swc-node/jest', { jsx: true, dynamicImport: true }],
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/fileTransformer.js',
},
transformIgnorePatterns: ['node_modules/(?!(react-dnd|dnd-core|react-dnd-html5-backend)/)'],
testURL: 'http://localhost:4000/admin',
globalSetup: '<rootDir>/test/config/front/global-setup.js',
};