-
Notifications
You must be signed in to change notification settings - Fork 145
/
jest.unit.config.js
48 lines (47 loc) · 1.45 KB
/
jest.unit.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
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
const path = require('path');
const merge = require('lodash/merge');
const tsPreset = require('ts-jest/jest-preset');
const cloudscapePreset = require('@cloudscape-design/jest-preset/jest-preset');
module.exports = merge({}, tsPreset, cloudscapePreset, {
verbose: true,
testEnvironment: 'jsdom',
reporters: ['default', 'github-actions'],
collectCoverage: process.env.CI === 'true',
coveragePathIgnorePatterns: [
'__tests__',
'__integ__',
'/design-tokens/',
'/node_modules/',
'styles.css.js$',
'styles.scoped.css$',
'styles.selectors.js$',
'icons.js$',
'environment.js$',
'/internal\\/vendor/',
'<rootDir>/pages',
],
coverageThreshold: {
global: {
branches: 82,
functions: 88,
lines: 90,
statements: 90,
},
},
globals: {
'ts-jest': {
tsconfig: 'tsconfig.unit.json',
},
},
transform: {
'(?!node_modules).*/lib/(components|design-tokens)/.*\\.js$': require.resolve(
'@cloudscape-design/jest-preset/js-transformer'
),
'(?!node_modules).*/lib/components/.*\\.css$': require.resolve('@cloudscape-design/jest-preset/css-transformer'),
},
setupFilesAfterEnv: [path.join(__dirname, 'build-tools', 'jest', 'setup.js')],
testRegex: '(/__tests__/.*(\\.|/)test)\\.[jt]sx?$',
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'd.ts'],
});