-
Notifications
You must be signed in to change notification settings - Fork 31
/
jest.config.js
66 lines (59 loc) · 1.72 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
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
/*
* Copyright (c) 2018, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
function unitTest({ nativeShadow }) {
return {
displayName: {
name: `unit (${nativeShadow ? 'native' : 'synthetic'} shadow)`,
color: nativeShadow ? 'blue' : 'cyan',
},
rootDir: '<rootDir>/packages',
testMatch: ['**/__tests__/**/?(*.)(test).js'],
globals: {
'lwc-jest': {
nativeShadow,
},
},
};
}
function integration({ nativeShadow }) {
return {
displayName: {
name: `integration (${nativeShadow ? 'native' : 'synthetic'} shadow)`,
color: nativeShadow ? 'blue' : 'cyan',
},
rootDir: '<rootDir>/test',
preset: '@lwc/jest-preset',
moduleNameMapper: {
'^smoke/(.+)$': '<rootDir>/src/modules/smoke/$1/$1',
'^(components)/(.+)$': '<rootDir>/src/modules/$1/$2/$2',
},
globals: {
'lwc-jest': {
nativeShadow,
},
},
};
}
module.exports = {
projects: [
unitTest({ nativeShadow: false }),
unitTest({ nativeShadow: true }),
integration({ nativeShadow: false }),
integration({ nativeShadow: true }),
{
displayName: {
name: `integration (ssr)`,
color: 'magenta',
},
rootDir: '<rootDir>/test',
preset: '@lwc/jest-preset/ssr',
moduleNameMapper: {
'^ssr/(.+)$': '<rootDir>/src/modules/ssr/$1/$1',
},
},
],
};