-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathjest.config.ts
39 lines (37 loc) · 1.47 KB
/
jest.config.ts
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
import type { Config } from '@jest/types';
const config: Config.InitialOptions = {
setupFilesAfterEnv: ['./jest.setup.ts'],
testEnvironment: 'jest-environment-jsdom',
testEnvironmentOptions: { customExportConditions: ['node', 'node-addons'] },
modulePaths: ['<rootDir>'],
moduleFileExtensions: ['js', 'json', 'vue', 'ts', 'tsx'],
moduleNameMapper: {
'^~/(.*)$': '<rootDir>/$1',
'^~~/(.*)$': '<rootDir>/$1',
'^@/(.*)$': '<rootDir>/$1',
'@shell/(.*)': '<rootDir>/node_modules/@rancher/shell/$1',
'@components/(.*)':
'<rootDir>/node_modules/@rancher/components/dist/@rancher/components.common.js',
'@kubewarden/(.*)': '<rootDir>/pkg/kubewarden/$1',
'@tests/(.*)': '<rootDir>/tests/$1',
},
transform: {
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
'.*\\.vue$': '<rootDir>/node_modules/@vue/vue3-jest',
'^.+\\.tsx?$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.json' }],
'^.+\\.svg$': '<rootDir>/tests/unit/config/svgTransform.ts' // to mock `*.svg` files
},
transformIgnorePatterns: ['/node_modules/(?!(@vue|@rancher|jsonpath-plus))'],
modulePathIgnorePatterns: [
'<rootDir>/scripts/',
'<rootDir>/assets/',
'<rootDir>/charts/',
'<rootDir>/extensions/',
'<rootDir>/tests/e2e/',
],
coverageDirectory: '<rootDir>/coverage/unit',
coverageReporters: ['json', 'text-summary'],
coverageProvider: 'v8',
preset: 'ts-jest',
};
export default config;