forked from nmstate/nmstate-console-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
34 lines (31 loc) · 1.07 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
import { pathsToModuleNameMapper } from 'ts-jest';
import type { Config } from '@jest/types';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { compilerOptions } = require('./tsconfig');
// Sync object
const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'jest-environment-jsdom',
testMatch: ['<rootDir>/src/**/*.{test,spec}.{js,jsx,ts,tsx}'],
moduleNameMapper: {
'\\.(css|less|scss|svg)$': '<rootDir>/src/__mocks__/dummy.ts',
'@console/*': '<rootDir>/src/__mocks__/dummy.ts',
'@openshift-console/*': '<rootDir>/src/__mocks__/dummy.ts',
'react-i18next': '<rootDir>/src/__mocks__/react-i18next.ts',
...pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
}),
},
modulePaths: ['<rootDir>'],
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
transform: {
'^.+\\.[t|j]sx?$': 'ts-jest',
},
transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@patternfly|@openshift-console\\S*?)/.*)'],
globals: {
'ts-jest': {
isolatedModules: true,
},
},
};
export default config;