我收到的错误消息是:
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'
Run Code Online (Sandbox Code Playgroud)
我的 tsconfig.json 文件是:
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"rootDir": "./src",
"outDir": "./dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
}
Run Code Online (Sandbox Code Playgroud)
我的 jest.config.ts 文件是:
export default {
clearMocks: true,
collectCoverage: true,
coverageDirectory: "coverage",
coverageProvider: "v8",
transform: {
"^.+\\.(t|j)sx?$": ["@swc/jest"],
},
};
Run Code Online (Sandbox Code Playgroud)
我试图完全遵循每个文档的指示。
我在这里做错了什么?