Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In search of the mysterious skipped Jest test

Tags:

jestjs

We have the following output at the end of our Jest test base:

Test Suites: 273 passed, 273 total
Tests:       1 skipped, 1923 passed, 1924 total
Snapshots:   61 passed, 61 total
Time:        38.885 s, estimated 39 s

You see there is one skipped test.

When I search my test files either for it.skip or test.skip or generally skip I find nothing.

What I also tried is outputting the test run into JSON via:

jest --json --outputFile=testrun.json 

In the top of the file I find this information:

{
  "numFailedTestSuites": 0,
  "numFailedTests": 0,
  "numPassedTestSuites": 273,
  "numPassedTests": 1923,
  "numPendingTestSuites": 0,
  "numPendingTests": 1,
  "numRuntimeErrorTestSuites": 0,
  "numTodoTests": 0,
  "numTotalTestSuites": 273,
  "numTotalTests": 1924,
  ...
}

so it looks like that numPendingTests is the one pointing to the skipped one. But when I search the output file, again, no trace of a skipped test. In fact, I did a search for "status": "[a-z]and there is no other status to be found than passed.

Short of looking through 270+ test suites, how else could a skipped test hide from me? Is there any way to find it?

like image 664
flq Avatar asked Nov 19 '25 16:11

flq


1 Answers

As mentioned by johnrsharp as a comment, another way to skip tests in Jest is to prefix the term it(test) with x- so if you want to scan the files for skipped tests, you also need to look out for xit, xtest or xdescribe

like image 178
flq Avatar answered Nov 21 '25 12:11

flq



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!