Skip to content

Commit

Permalink
reuse base jest config in e2e specific config
Browse files Browse the repository at this point in the history
  • Loading branch information
sitek94 committed Nov 25, 2023
1 parent d260a6c commit 850376b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
3 changes: 2 additions & 1 deletion apps/nestjs/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @type {import('jest').Config} */
module.exports = {
preset: 'ts-jest',
transform: {
Expand All @@ -14,5 +15,5 @@ module.exports = {
'^.+\\.(t|j)s$': 'ts-jest',
},
collectCoverageFrom: ['**/*.(t|j)s'],
coverageDirectory: '../coverage',
coverageDirectory: './coverage',
}
29 changes: 4 additions & 25 deletions apps/nestjs/test/jest-e2e.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
// 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')
const baseConfig = require('../jest.config')

/** @type {import('jest').Config} */
module.exports = {
preset: 'ts-jest',
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
moduleFileExtensions: ['js', 'json', 'ts'],
moduleNameMapper: {
'^~/(.*)$': '../src/$1',
},
testEnvironment: 'node',
...baseConfig,

// E2E specific settings
rootDir: '.',
testRegex: '.e2e-spec.ts$',
collectCoverageFrom: ['**/*.(t|j)s'],
coverageDirectory: '../coverage',
}

// {
// // "moduleFileExtensions": ["js", "json", "ts"],
// "rootDir": ".",
// "testEnvironment": "node",

// "transform": {
// "^.+\\.(t|j)s$": "ts-jest"
// }
// }

0 comments on commit 850376b

Please sign in to comment.