const { pathsToModuleNameMapper } = require('ts-jest'); const { compilerOptions: { paths = {}, baseUrl = './' }, } = require('./tsconfig.json'); const environment = require('./webpack/environment'); module.exports = { transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$|dayjs/esm)'], resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js', globals: { ...environment, }, roots: ['', `/${baseUrl}`], modulePaths: [`/${baseUrl}`], setupFiles: ['jest-date-mock'], cacheDirectory: '/target/jest-cache', coverageDirectory: '/target/test-results/', moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: `/${baseUrl}/` }), reporters: [ 'default', ['jest-junit', { outputDirectory: '/target/test-results/', outputName: 'TESTS-results-jest.xml' }], ['jest-sonar', { outputDirectory: './target/test-results/jest', outputName: 'TESTS-results-sonar.xml' }], ], testMatch: ['/src/main/webapp/app/**/@(*.)@(spec.ts)'], testEnvironmentOptions: { url: 'https://jhipster.tech', }, };