46

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

7
  • 13
    Those functions will still be there, the message is telling you that the overall run will now be incomplete, not passed, if all the focused tests pass.
    – jonrsharpe
    May 28, 2018 at 7:36
  • 25
    Thanks. They should have logged it as a WARN instead.
    – heldt
    May 28, 2018 at 8:17
  • I think an error is more accurate in this case. If you forget to remove fit or fdescribe from your specs I want my CI to fail! Aug 28, 2018 at 20:51
  • 10
    FWIW, I agree with @heldt, deprecation usually implies an alternative. If nothing is actually broken and no alternative exists, then what are we supposed to do? Sep 26, 2018 at 0:01
  • 1
    Is this still an issue? It looks like it had been resolved here: github.com/karma-runner/karma-jasmine/issues/202 and maybe related here: github.com/jasmine/jasmine/issues/1532 Feb 28, 2019 at 18:30

2 Answers 2

13
+25

As per your link to fit docs

fit will focus on a test or a set of them.

so if you have 5 tests, 3it and 2fit, only the 2 with fit will run by Jasmine.

ERROR: 'DEPRECATION: fit and fdescribe will cause your suite to report an 'incomplete' status in Jasmine 3.0'

ERROR --> WARNING: Is telling you that only fit'S will run, therefore an incomplete test.

Thanks.

5
  • 5
    Yeah but when it says stuff like deprecation, I prefer to run the tests in a way that's up-to-date and not some deprecated syntax. The problem OP has (as do we), is that there seems to be no alternatives offered to rely on instead of the deprecated stuff. Mar 1, 2019 at 13:48
  • 3
    For my understanding, you should only use fit in the case you creating a new test so you don't need to wait for the others to check it. Then set it back to it to run them all.
    – T04435
    Mar 1, 2019 at 23:57
  • 8
    That's actually a good idea. However, as far the question is concerned, we'd still get the deprecation warning, and it bothers me that I have no up-to-daty alternatives to change to. Mar 2, 2019 at 16:49
  • This is especially bothersome when adding karma-chai and stuff in... fit or fdescribe make the entire thing stop working, including the ones we're trying to focus on Oct 7, 2020 at 21:53
  • This answer seems to explain what fit does whereas the question is about deprecation May 12, 2022 at 15:13
4

They have fixed the warning. I am using jasmine v3.3.1 and I don't see such a message:

Console output showing the jasmine test run for the sample code below. Only the 'fit' block in the 'fdescribe' definition as well as the 'fit' block in the regular 'describe' definition got executed.

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");
  });
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.