forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
53 lines (52 loc) · 1.92 KB
/
Copy pathjest.config.js
File metadata and controls
53 lines (52 loc) · 1.92 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
45
46
47
48
49
50
51
52
53
/**
* Copyright IBM Corp. 2018, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
export default {
preset: 'jest-config-carbon',
testEnvironment: 'jsdom',
testMatch: [
'<rootDir>/**/__tests__/**/*.@(js|jsx|ts|tsx)',
'<rootDir>/**/*.(spec|test).@(js|jsx|ts|tsx)',
'<rootDir>/**/*-(spec|test).@(js|jsx|ts|tsx)',
],
collectCoverageFrom: [
'packages/**/src/**/*.js',
'packages/**/src/**/*.tsx',
'!packages/{cli,components}/**',
'!packages/**/{examples,stories}/**',
'!**/*-story.js',
'!**/*.stories.js',
'!**/*-test.e2e.js',
],
coveragePathIgnorePatterns: [
'packages/web-components/*',
// scss-generator coverage is collected by `yarn test:scss-generator`,
// which scopes VM modules to the Prettier 3 dynamic imports in that package.
'packages/scss-generator/*',
],
testPathIgnorePatterns: [
'packages/web-components/*',
// scss-generator is covered by `yarn test:scss-generator`, which scopes
// VM modules to the Prettier 3 dynamic imports in that package.
'packages/scss-generator/*',
// e2e already covered by the `test:e2e` job via jest.e2e.config.js
'<rootDir>/e2e/',
],
transformIgnorePatterns: [
'<rootDir>/node_modules/(?!lodash-es|nanoid|chalk|@babel/|temporal-polyfill|temporal-utils)',
],
moduleNameMapper: {
// Jest uses identity-obj-proxy to mock CSS/SCSS imports.
'\\.(css|scss)$': 'identity-obj-proxy',
// Some packages (e.g. @carbon/utilities) write relative imports with an
// explicit `.js` extension that resolves to a `.ts` source file (valid
// under "moduleResolution": "bundler"). Jest resolves `.js` literally, so
// strip it and let `moduleFileExtensions` fall back to `.ts`/`.tsx`.
'^(\\.{1,2}/.*)\\.js$': '$1',
},
reporters: ['default', 'jest-junit'],
extensionsToTreatAsEsm: ['.jsx', '.ts', '.tsx'],
};