72G*_*2GM 16 karma-runner angular-cli angular
当存在相当普遍的错误(是的源映射是错误的)时,识别失败的测试可能会非常困难,如果我们可以显示测试名称而不是“已执行 27 of 172”,将会有很大帮助
类似于“执行 27 (TextActivityService Test) of 172
我在这里指的是所有测试都通过但控制台报告错误的时间。
这可能吗?
小智 8
您需要使用Karma Spec Reporter。
用法:
npm install karma-spec-reporter --save-dev
karma.conf.js
// karma.conf.js
Run Code Online (Sandbox Code Playgroud)... config.set({ ... reporters: ["spec"], specReporter: { maxLogLines: 5, // limit number of lines logged per test suppressErrorSummary: true, // do not print error summary suppressFailed: false, // do not print information about failed tests suppressPassed: false, // do not print information about passed tests suppressSkipped: true, // do not print information about skipped tests showSpecTiming: false // print the time elapsed for each spec }, plugins: ["karma-spec-reporter"], ...
当某些单元测试失败时,它会显示describe
消息it
作为测试用例名称。
例如:
describe('TestComponent', () => {
it('should pass test', () => {
expect(false).toBeTruthy();
});
});
Run Code Online (Sandbox Code Playgroud)
TestComponent should pass test FAILED
Expected false to be truthy
然后,上述失败的单元测试将在控制台中显示。
归档时间: |
|
查看次数: |
2529 次 |
最近记录: |