I get the error:
ERROR: 'DEPRECATION: fit and fdescribe will cause your suite to report an 'incomplete' status in Jasmine 3.0'
I did a RTFM for Jasmine 3.0 but it did not mention anything about deprecation: https://jasmine.github.io/api/3.0/global.html#fit
They have fixed the warning. I am using jasmine v3.3.1 and I don't see such a message:
So we can still use fit
and fdescribe
, please read the below code and its comments. It's tested and easy to understand.
// 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");
});
});