-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
44 lines (42 loc) · 2.39 KB
/
Copy pathjest.config.js
File metadata and controls
44 lines (42 loc) · 2.39 KB
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
// SPDX-License-Identifier: BUSL-1.1
const { jestConfig } = require('@salesforce/sfdx-lwc-jest/config');
module.exports = {
...jestConfig,
moduleNameMapper: {
...jestConfig.moduleNameMapper,
'^lightning/flowSupport$': '<rootDir>/force-app/test/jest-mocks/lightning/flowSupport.js',
'^lightning/modal$': '<rootDir>/force-app/test/jest-mocks/lightning/modal.js',
'^c/componentBuilder$': '<rootDir>/force-app/test/jest-mocks/c/componentBuilder.js',
// The sfdx-lwc-jest jsdom environment resolves `cheerio` to its browser ESM
// build (bare `export`), which jest cannot load. Pin to the CommonJS *slim*
// build: it provides the full DOM API (load/find/contents/text) the doc
// converter uses, without cheerio's `undici`/fetch dependency (which needs
// web globals jsdom omits). Tests that `jest.mock('cheerio')` still override this.
'^cheerio$': '<rootDir>/node_modules/cheerio/dist/commonjs/slim.js'
},
// evidence/ holds git-ignored local clones of third-party repos; their suites and lwc
// module trees must never run or collide with this project's — a broad --testPathPattern
// like "force-app/main/default/lwc" would otherwise match them too.
modulePathIgnorePatterns: ['<rootDir>/.localdevserver', '<rootDir>/tmp/', '<rootDir>/evidence/'],
// release-testing/e2e/helpers/capture-overlay.smoke.test.js is a Playwright BROWSER smoke test
// (it launches chromium) run via `node --test`, not a jest unit test — jest can't load it, so
// its dir is excluded (alongside the Playwright e2e specs). The processor's pure-function unit
// tests live in release-testing/__tests__ and run as normal jest under `npm run test:release`.
testPathIgnorePatterns: ['/node_modules/', '/coverage/', '/release-testing/e2e/specs/', '/release-testing/e2e/helpers/', '<rootDir>/tmp/', '<rootDir>/evidence/', '/__tests__/fixtures/'],
collectCoverageFrom: [
'force-app/main/default/lwc/**/*.js',
'scripts/**/*.js',
'scanner/eslint-plugin-kerndx/**/*.js',
'release-testing/runner/**/*.js',
'release-testing/e2e/helpers/**/*.js',
'!**/__tests__/**',
'!**/*.test.js',
'!**/*.spec.js',
'!force-app/test/jest-mocks/**'
],
coveragePathIgnorePatterns: [
'/node_modules/',
'/__tests__/',
'/force-app/test/jest-mocks/'
]
};