The error message I am getting is:
File 'd:/Project/server/jest.config.ts' is not under 'rootDir'
'd:/Project/server/src'. 'rootDir' is expected to contain all source files.
The file is in the program because:
Matched by include pattern '**/*' in 'd:/Project/server/tsconfig.json'
My tsconfig.json file is:
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"rootDir": "./src",
"outDir": "./dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
}
My jest.config.ts file is:
export default {
clearMocks: true,
collectCoverage: true,
coverageDirectory: "coverage",
coverageProvider: "v8",
transform: {
"^. \\.(t|j)sx?$": ["@swc/jest"],
},
};
I am trying to exactly follow the directives of each documentation.
What am I doing wrong here?
CodePudding user response:
You have to move your jest.config.ts
file inside your src/
directory in order to work. The error is self explanatory I would say.