Pas*_*cal 5 jasmine karma-runner karma-jasmine angular-cli angular
我正在使用Angular 6,Karma和Jasmine设置新的解决方案。但是令我惊讶的是,规格列表正在获取以下未定义的类:
<li class="undefined" id="spec-spec1" spec-suite-id="suite3">
<a href="?spec=Router%3A%20App%20looks%20async%20but%20is%20synchronous">
looks async but is synchronous
</a>
</li>
Run Code Online (Sandbox Code Playgroud)
使用Angular 5,结果如下所示:正在运行的规格以绿色清晰显示,而跳过的规格以灰色显示
如何使用CLI在Angular 6生成的测试中调试它?
小智 -1
您可以编写 console.log 将日志写入控制台,或者直接在测试中编写“调试器”并打开运行测试的浏览器的开发人员控制台。
始终只在出现问题的地方运行测试。为此,您可以在describe() 和it() 之前专注于使用“f”进行测试,因此仅执行此测试。
fdescribe("when ...", function () { // to [f]ocus on a single group of tests
fit("should ...", function () {...}); // to [f]ocus on a single test case
});
Run Code Online (Sandbox Code Playgroud)
... 和:
xdescribe("when ...", function () { // to e[x]clude a group of tests
xit("should ...", function () {...}); // to e[x]clude a test case
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
453 次 |
| 最近记录: |