Skip to content

Commit

Permalink
test(jest): Reuse jest config in pacts config
Browse files Browse the repository at this point in the history
  • Loading branch information
kulla committed Nov 30, 2023
1 parent 37b4654 commit a392a4b
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions jest.config-pacts-serlo-org-database-layer.cjs
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
/* eslint-disable @typescript-eslint/no-var-requires,import/no-commonjs */
// eslint-disable-next-line import/no-extraneous-dependencies
const { pathsToModuleNameMapper } = require('ts-jest')

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,import/extensions
const { compilerOptions } = require('./tsconfig.json')
// eslint-disable-next-line import/no-commonjs
const defaultConfig = require('./jest.config.cjs')

module.exports = {
modulePaths: ['<rootDir>/packages'],
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
moduleNameMapper: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument
...pathsToModuleNameMapper(compilerOptions.paths),
'@serlo/api': '@serlo/api/src',
'@serlo/authorization': '@serlo/authorization/src',
},
setupFiles: ['dotenv/config'],
...defaultConfig,
setupFilesAfterEnv: [
'<rootDir>/__config__/jest.setup-pacts-serlo-org-database-layer.ts',
],
testEnvironment: 'node',
testRegex: '/__tests-pacts__/index\\.ts',
transform: {
'^.+\\.tsx?$': ['ts-jest', { useESM: true, isolatedModules: true }],
'^.+\\.graphql$': './transform-graphql-jest-28-shim.cjs',
},
extensionsToTreatAsEsm: ['.ts', '.tsx', '.mts'],
watchPathIgnorePatterns: ['<rootDir>/pacts/'],
}

0 comments on commit a392a4b

Please sign in to comment.