35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
const { pathsToModuleNameMapper } = require('ts-jest')
|
|
// In the following statement, replace `./tsconfig` with the path to your `tsconfig` file
|
|
// which contains the path mapping (ie the `compilerOptions.paths` option):
|
|
const { compilerOptions } = require('./tsconfig.json')
|
|
|
|
module.exports = {
|
|
moduleFileExtensions: ['js', 'json', 'ts'],
|
|
rootDir: '.',
|
|
testRegex: '.*\\.spec\\.ts$',
|
|
|
|
collectCoverageFrom: ['**/*.(t|j)s'],
|
|
coverageDirectory: '../coverage',
|
|
extensionsToTreatAsEsm: ['.ts'],
|
|
preset: 'ts-jest',
|
|
testEnvironment: 'node',
|
|
globals: {
|
|
'ts-jest': {
|
|
useESM: true,
|
|
},
|
|
isDev: process.env.NODE_ENV === 'development',
|
|
},
|
|
setupFiles: ['./test-setup.js'],
|
|
moduleNameMapper: {
|
|
...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
|
|
|
|
'^src/(.*)$': '<rootDir>/src/$1',
|
|
'^test/(.*)$': '<rootDir>/test/$1',
|
|
'^src$': '<rootDir>/src',
|
|
'^~/(.*)$': '<rootDir>/src/$1',
|
|
'^~$': '<rootDir>/src',
|
|
'^test$': '<rootDir>/test',
|
|
},
|
|
}
|