版本:11.10.0 操作系统:Ubuntu 范围:调试测试用例 模块:Zest测试框架 IDE:VSCode
我正在尝试调试我的测试用例。 spec.ts文件中的所有断点均有效。但是src / folders中的断点,即控制器文件永远无法工作。 VSCode将它们显示为未经验证的断点。
launch.json:
{
"type": "node",
"request": "launch",
"name": "Jest Tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": ["--runInBand","-i", "--config=${workspaceFolder}/jest.config.js"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"outFiles": [
"${workspaceRoot}/dist/**/*"
],
"envFile": "${workspaceRoot}/.env"
}
tsconfig.js:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": false,
"allowJs": true /* Allow javascript files to be compiled. */,
"checkJs": false /* Report errors in .js files. */,
"sourceMap": true,
"outDir": "./dist",
"baseUrl": ".",
"paths": {
"*": [
"node_modules/*",
"src/types/*"
]
},
"types": ["jest"]
},
"exclude": ["dist", "src/test"],
"include": [
"src"
],
"types": ["src/types"]
}
jest.config.js
module.exports = {
globals: {
'ts-jest': {
tsConfigFile: 'tsconfig.json'
}
},
moduleFileExtensions: [
'ts',
'js'
],
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.js$': 'babel-jest'
},
transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"],
testMatch: [
'**/*.spec.ts'
],
testEnvironment: 'node',
testResultsProcessor: "jest-sonar-reporter",
coveragePathIgnorePatterns: [".*\\.d\\.ts"],
collectCoverageFrom: [
"src/**/**/*.{ts}",
"!src/index.ts"
]
};