jest --changesSince runs coverage on unchanged reference files

Viewed 47

Example:

I import code from anotherFile.js into both myFile.js and myFile.test.js to assert that the imported code was called correctly.

When I run jest with --changesSince and --coverage it thinks anotherFile.js was a changed file (via reference I think) and also runs a coverage on that.

Problem is that the coverage for anotherFile.js now falls below the coverage threshold even though anotherFile.js has its own test file and coverage above the coverage threshold.

My understanding is that anotherFile.test.js never runs and that the coverage is done solely on myFile.test.js

Expected:

To either not run coverage on referenced unchanged files or to at least run the test file for the unchanged reference files.

Questions:

  • Is it expected behaviour to run coverage on unchanged referenced/imported files?
  • If yes then how can one avoid the coverage threshold failing?

Hopefully this explains the issue. If any additional information is needed let me know.

0 Answers
Related