-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
Version
29.5.0
Steps to reproduce
- Clone repo: https://github.com/danieldiekmeier/jest-custom-reporter-reproduction
npm i
npm test
In the output and in the reporter.js
file, you can see that I had to use a setInterval
to keep my custom reporter running until after the CoverageReporter
is finished collecting the coverage. In Jest 27, this wasn't necessary – by the time my custom reporter ran, the CoverageReporter
was already finished.
Expected behavior
I expect my custom reporters to run last (like they did in Jest 27). Alternatively, it'd be fine if I could influence the order somehow.
Actual behavior
The coverage reporter runs after my custom reporter, making it impossible to use its results in custom reporters.
Additional context
This is the new code in Jest >=28.0.0, which registers the CoverageReporter
after the custom reporter: https://github.com/facebook/jest/blob/v28.0.0/packages/jest-core/src/TestScheduler.ts#L329-L364
Up until Jest 27.5.1, the code looked like this, registering the CoverageReporter
first: https://github.com/facebook/jest/blob/v27.5.1/packages/jest-core/src/TestScheduler.ts#L349-L380
This is probably a duplicate of the automatically closed #13479.
Environment
System:
OS: macOS 13.3
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 16.19.1 - ~/.asdf/installs/nodejs/16.19.1/bin/node
npm: 9.6.0 - ~/.asdf/plugins/nodejs/shims/npm
npmPackages:
jest: ^29.5.0 => 29.5.0