-
Notifications
You must be signed in to change notification settings - Fork 172
/
config.js
40 lines (35 loc) · 1.37 KB
/
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
/*
* 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
*/
'use strict';
const path = require('path');
const jestPreset = require('@lwc/jest-preset');
const { PROJECT_ROOT, getModulePaths } = require('./utils/project.js');
function getCoveragePaths() {
const modulePaths = getModulePaths();
return modulePaths.map((p) => {
// convert back to forward slashes here on Windows for Jest to be happy
return p.replace(/\\/g, '/') + '/**/*.js';
});
}
const jestConfig = {
rootDir: PROJECT_ROOT,
moduleFileExtensions: ['js', 'html'],
testEnvironment: jestPreset.testEnvironment || 'jsdom',
transform: {
'^.+\\.(js|html|css)$': require.resolve('@lwc/jest-transformer'),
},
transformIgnorePatterns: [
'/node_modules/(?!(.*@salesforce/sfdx-lwc-jest/src/lightning-stubs)/)',
],
setupFilesAfterEnv: jestPreset.setupFilesAfterEnv || [],
resolver: path.resolve(__dirname, './resolver.js'),
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/test/specs/'],
collectCoverageFrom: getCoveragePaths(),
snapshotSerializers: [require.resolve('@lwc/jest-serializer')],
};
const expectedApiVersion = '51.0';
module.exports = { jestConfig, expectedApiVersion };