【发布时间】:2017-09-12 12:14:05
【问题描述】:
我有使用Angular CLI 生成的角度项目。
我想调试 e2e 测试。 正如我不明白的那样,为了做到这一点,我应该将测试从 *.ts 编译到 *.js, 我找到了这个信息here,但它对我不起作用。
我还阅读了this 文章,但它对我也不起作用。
我做错了什么?请帮帮我...我花了一个星期没有结果...
我的 .vscode 文件夹和 tasks.json 文件
{
"version": "0.1.0",
"command": "npm",
"isShellCommand": true,
"showOutput": "always",
"suppressTaskName": true,
"tasks": [
{
"taskName": "e2e-compile",
"isBuildCommand": true,
"args": [
"run",
"e2e-compile"
]
}
]
}
launch.json 文件
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch e2e Tests",
"type": "node",
"request": "launch",
"stopOnEntry": false,
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"args": [
"${workspaceRoot}/protractor.conf.debug.js"
],
"preLaunchTask": "e2e-compile",
"cwd": "${workspaceRoot}",
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/dist/out-tsc-e2e/*.js"
]
}
]
}
protractor.config.debug.js 文件
var SpecReporter = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./dist/out-tsc-e2e/**/*.e2e-spec.js'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
useAllAngular2AppRoots: true,
beforeLaunch: function() {
},
onPrepare: function() {
jasmine.getEnv().addReporter(new SpecReporter());
}
};
然后我正在添加断点并使用 F5 进行调试,我正在等待暂停但它只是失败了。 如有任何帮助,我将不胜感激。
【问题讨论】:
标签: angularjs angular typescript visual-studio-code