【发布时间】:2018-10-16 15:58:57
【问题描述】:
我的单元测试是用 jasmine 编写的,并且在 typescript 中
// about.service.spec.ts
// say 4 to 5 test cases
// spec/support/jasmine.json
{
"spec_dir": "src/tests/",
"spec_files": ["**/*.spec.ts"],
"helpers": ["jasmine-helpers/**/*.ts"],
...
}
// launch.json - vscode file
{
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "Jasmine tests",
"preLaunchTask": "debuggertests",
}]
}
// tasks.json - vscode
{
"version": "2.0.0",
"tasks": [{
"label": "debuggertests",
"type": "npm",
"script": "test:unit",
"problemMatcher": []
}]
}
// package.json
// have to use jasmine-ts which is flavor over ts-node
"test:unit": "jasmine-ts JASMINE_CONFIG_PATH=spec/support/jasmine.json"
我已使用此配置在 vscode 中调试 .spec.ts 文件,但它没有触发调试器,而是运行所有测试并开始调试。
我在 about.service.spec.ts 的一个测试用例中设置了一个断点,但没有触发断点。谁能帮我设置 jasmine 测试的 vscode 调试?
【问题讨论】:
标签: node.js typescript jasmine visual-studio-code