Upgrading from angular 12 to angular 16. In the process 100% of my tests seem to be failing. All the errors seem to signify a missing node module. I am not sure what I am missing. Any help is extremely appreciated. Thanks!
error screenshot here
Here is my jest.config.js:
const path = require('path');
module.exports = {
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
testEnvironment: 'jsdom',
transform: {
'^.+\.(ts|js|html)$': 'ts-jest',
},
moduleNameMapper: {
'^@app/(.*)$': '<rootDir>/src/app/$1',
'^@environments/(.*)$': '<rootDir>/src/environments/$1',
'^@src/(.*)$': '<rootDir>/src/$1',
'^@assets/(.*)$': '<rootDir>/src/assets/$1',
'^@styles/(.*)$': '<rootDir>/src/styles/$1',
},
transformIgnorePatterns: ['node_modules/(?!.*\.mjs$)'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\.html$',
},
},
globalSetup: path.resolve(__dirname, 'jest-global-setup.js'),
resolver: path.resolve(__dirname, 'src/jest.resolver.js'),
};
I have tried using jest 28.0.0. Currently using 27.5.1 in jest-environment-jsdom, jest in my package.json
Emmanuel Huff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.