-
Notifications
You must be signed in to change notification settings - Fork 37
Conversation
build/merge-coverage.js
Outdated
env => | ||
new Promise(resolve => { | ||
const interval = setInterval(() => { | ||
const coverageExists = fs.existsSync( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought exists was being deprecated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like exists() is being deprecated, but existsSync() is not.
const fs = require('fs'); | ||
|
||
// Jest writes coverage after the process exits | ||
// so we need to poll and wait for all coverage files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if there is an error and coverage is never written?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The node process should just exit in this case, killing the CLI as well. I'll go ahead and include a timeout here though in case coverage never gets written for some reason.
@@ -1 +1 @@ | |||
coverage/ | |||
coverage*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make sure to make this change in the scaffold.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
!merge |
This creates multiple coverage folders depending on what test suites are run (node, jsdom), and merges them after coverage is collected into a single coverage/ folder. There is some weirdness around the jest process exiting before coverage is done writing to disk, so we wait until expected coverage files are present before merging.
Fixes #121