I encountered a strange error. After updating jest to version 27, everything stopped working.
It appears to be having trouble with import paths. For example, the following code does not work:
import { something } form 'src/app/components/.....';
However, this code does work:
import { something } from '../../components/....';
I suspect that this issue is related to my tsconfig setup. Here is my configuration for the spec
tsconfig file:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jest", // 1
"node",
"Chrome"
],
"esModuleInterop": true, // 2
"emitDecoratorMetadata": true, // 3
"allowSyntheticDefaultImports": true,
},
"files": ["src/test.ts", "src/polyfills.ts"],
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
}
And here is my main tsconfig configuration:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"module": "es2020",
"lib": ["es2018", "dom"],
"types": [],
"paths": {
"@shared/*": ["src/shared/*"]
},
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"noEmitHelpers": false
},
"files": ["src/main.ts", "src/polyfills.ts"],
"angularCompilerOptions": {
"strictTemplates": true,
"fullTemplateTypeCheck": true
}
}
Does anyone have any suggestions on what could be causing this import issue?