Mocha not running xState/test example because of test ordering. #1784
Replies: 2 comments
-
It seems like a Mocha quirk that it executes |
Beta Was this translation helpful? Give feedback.
-
The coverage test is dependent on all the tests running... and if I recall correctly, Jest doesn't (yet) do dependent tests. You can make tests run in order via I'm going to rethink this for the next version of it('should reach all paths', async () => {
// TENTATIVE FUTURE API
await assertPaths(someTestModel.getShortestPaths());
someTestModel.testCoverage();
}); The "downside" is that you won't get individual tests for each path tested, which only really matters in reporting. Maybe there is a way to programmatically hook into Jest's API for this. |
Beta Was this translation helpful? Give feedback.
-
Hi, I was running this from the documentation
But my test coverage was always failing.. The problem appears to be that the "should have full coverage" test was run first, because the other tests are nested in a describe grouping and it is not.
I'm no expert on Javascript or Mocha, so maybe I'm doing it wrong, but if I comment out the describe block, or add a describe block around the full coverage test, then it successfully runs (all code coverage passes). Smoking gun in my book.
Beta Was this translation helpful? Give feedback.
All reactions