vben
2021-08-21 6e857957371b5ff434e1661d28f3da693f086860
提交 | 用户 | age
f6fe1d 1 export default {
V 2   preset: 'ts-jest',
3   roots: ['<rootDir>/tests/'],
4   clearMocks: true,
5   moduleDirectories: ['node_modules', 'src'],
6   moduleFileExtensions: ['js', 'ts', 'vue', 'tsx', 'jsx', 'json', 'node'],
7   modulePaths: ['<rootDir>/src', '<rootDir>/node_modules'],
8   testMatch: [
9     '**/tests/**/*.[jt]s?(x)',
10     '**/?(*.)+(spec|test).[tj]s?(x)',
11     '(/__tests__/.*|(\\.|/)(test|spec))\\.(js|ts)$',
12   ],
13   testPathIgnorePatterns: [
14     '<rootDir>/tests/server/',
15     '<rootDir>/tests/__mocks__/',
16     '/node_modules/',
17   ],
18   transform: {
19     '^.+\\.tsx?$': 'ts-jest',
20   },
21   transformIgnorePatterns: ['<rootDir>/tests/__mocks__/', '/node_modules/'],
22   // A map from regular expressions to module names that allow to stub out resources with a single module
23   moduleNameMapper: {
24     '\\.(vs|fs|vert|frag|glsl|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
25       '<rootDir>/tests/__mocks__/fileMock.ts',
26     '\\.(sass|s?css|less)$': '<rootDir>/tests/__mocks__/styleMock.ts',
27     '\\?worker$': '<rootDir>/tests/__mocks__/workerMock.ts',
28     '^/@/(.*)$': '<rootDir>/src/$1',
29   },
30   testEnvironment: 'jsdom',
31   verbose: true,
32   collectCoverage: false,
33   coverageDirectory: 'coverage',
34   collectCoverageFrom: ['src/**/*.{js,ts,vue}'],
35   coveragePathIgnorePatterns: ['^.+\\.d\\.ts$'],
36 };