hel*_*ldt 42 testing jasmine karma-runner angular
我收到错误:
ERROR: 'DEPRECATION: fit and fdescribe will cause your suite to report an 'incomplete' status in Jasmine 3.0'
Run Code Online (Sandbox Code Playgroud)
我为Jasmine 3.0做了一个RTFM,但没有提到任何关于弃用的内容:https://jasmine.github.io/api/3.0/global.html#fit
根据您适合文档的链接
fit
将重点放在一个或一组测试上。
因此,如果您有5个测试3 it
和2 fit
,那么只有2个适合的测试将由Jasmine进行。
ERROR: 'DEPRECATION: fit and fdescribe will cause your suite to report an 'incomplete' status in Jasmine 3.0'
ERROR --> WARNING:
告诉您只会运行fit'S,因此测试不完整。
谢谢。
他们已经修正了警告。我正在使用 jasmine v3.3.1,但没有看到这样的消息:
所以我们仍然可以使用fit
and fdescribe
,请阅读下面的代码及其注释。它经过测试并且易于理解。
// If you want to run a few describes only, add 'f' so using focus only those
// 'fdescribe' blocks and their 'it' blocks get run
fdescribe("Focus description: I get run with all my it blocks", function () {
it("1) it in fdescribe gets executed", function () {
console.log("1) gets executed unless there's a fit within fdescribe");
});
it("2) it in fdescribe gets executed", function () {
console.log("2) gets executed unless there's a fit within fdescribe");
});
// But if you add 'fit' in an 'fdescribe' block, only the 'fit' block gets run
fit("3) only fit blocks in fdescribe get executed", function () {
console.log("If there's a fit in fdescribe, only fit blocks get executed");
});
});
describe("Regular description: I get skipped with all my it blocks", function () {
it("1) it in regular describe gets skipped", function () {
console.log("1) gets skipped");
});
it("2) it in regular describe gets skipped", function () {
console.log("2) gets skipped");
});
// Will a 'fit' in a regular describe block get run? Yes!
fit("3) fit in regular describe still gets executed", function () {
console.log("3) fit in regular describe gets executed, too");
});
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6479 次 |
最近记录: |