-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
27 lines (24 loc) · 1.03 KB
/
jest.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
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
moduleNameMapper: {
// if your using tsconfig.paths thers is no harm in telling jest
'@components/(.*)$': '<rootDir>/src/components/$1',
'@/(.*)$': '<rootDir>/src/$1',
// mocking assets and styling
'^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/tests/unit/mocks/file.mock.ts',
'^.+\\.(css|less|scss|sass)$': '<rootDir>/tests/unit/mocks/style.mock.ts',
/* mock models and services folder */
'(assets|models|services)': '<rootDir>/tests/unit/mocks/file.mock.ts',
},
// to obtain access to the matchers.
setupFilesAfterEnv: ['./tests/unit/jest.setup.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
modulePaths: ['<rootDir>'],
testEnvironment: 'jsdom',
// code coverage
// collectCoverage: true, // always generate coverage
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
coverageDirectory: 'coverage',
};