Skip to content

Instantly share code, notes, and snippets.

@paulodutra
Last active August 11, 2024 16:46
Show Gist options
  • Save paulodutra/e57e0296a73b814debfcc0203db6bf48 to your computer and use it in GitHub Desktop.
Save paulodutra/e57e0296a73b814debfcc0203db6bf48 to your computer and use it in GitHub Desktop.
Module name mapper jest
module.exports = {
preset: 'ts-jest',
moduleFileExtensions: ['js', 'json', 'ts', 'node'],
rootDir: 'src',
testRegex: '.*\\.spec\\.ts$',
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
'^@test/(.*)$': '<rootDir>/test/$1',
},
collectCoverageFrom: ['**/*.(t|j)s'],
coverageDirectory: '../coverage/',
testEnvironment: 'node',
coveragePathIgnorePatterns: ['main.ts', '.module.ts$'],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment