Open gloriaJun opened 3 years ago
const path = require('path'); const { pathsToModuleNameMapper } = require('ts-jest/utils'); const { compilerOptions } = require(path.resolve(process.cwd(), './tsconfig.json')); console.log(pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' })); module.exports = { projects: ['<rootDir>'], roots: ['<rootDir>/src'], preset: 'ts-jest', // testEnvironment: 'node', // Automatically clear mock calls and instances between every test verbose: true, // 각 테스트 종료 후, mock clear를 실행하기 위함 // https://haeguri.github.io/2020/12/21/clean-up-jest-mock/ restoreMocks: true, clearMocks: true, testMatch: ['<rootDir>/(src|tests)/**/*.(spec|test).[jt]s?(x)'], setupFiles: ['<rootDir>/tests/unit/testSetup.js', 'jest-canvas-mock'], setupFilesAfterEnv: ['@testing-library/jest-dom'], // setupFilesAfterEnv: ['@testing-library/react/cleanup-after-each'], moduleDirectories: ['node_modules', 'src'], moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),