generated from latipun7/webcomponents-webpack-ts
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
47 lines (43 loc) · 1.38 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
40
41
42
43
44
45
46
47
import { jsWithBabel as tsJestPreset } from 'ts-jest/presets';
import { pathsToModuleNameMapper } from 'ts-jest/utils';
import type { InitialOptionsTsJest } from 'ts-jest/dist/types';
import { compilerOptions } from './tsconfig.json';
const tsconfigPaths = pathsToModuleNameMapper(compilerOptions.paths);
const config: InitialOptionsTsJest = {
preset: 'ts-jest',
verbose: true,
testEnvironment: 'jsdom',
moduleDirectories: ['node_modules', '<rootDir>'],
setupFiles: ['fake-indexeddb/auto'],
setupFilesAfterEnv: ['@testing-library/jest-dom'],
moduleNameMapper: {
'\\.(css|sass|scss)$': 'identity-obj-proxy',
'^assets\\/(.*)(?:\\?raw|\\?inline)$': 'src/assets/$1',
...tsconfigPaths,
},
testPathIgnorePatterns: ['<rootDir>/node_modules', '<rootDir>/dist'],
transform: {
...tsJestPreset.transform,
'\\.(svg|jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/tests/files.transformer.js',
'\\.(html|svg\\?raw|svg\\?inline)$': '<rootDir>/tests/html.transformer.js',
},
transformIgnorePatterns: [
'/node_modules/',
'\\.pnp\\.[^\\/]+$',
'\\.(css|sass|scss)$',
],
globals: {
'ts-jest': {
babelConfig: {
presets: [
[
'@babel/preset-env',
{ modules: 'commonjs', targets: { node: 'current' } },
],
],
},
},
},
};
export default config;