Fix tests on Windows in node10 branch #307
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix tests on Windows by avoiding bug in spawn-wrap by using spawnSync instead of execSync
I didn't get to the root of the problem, but I think I've proven that the failing test was due to a bug in tap, probably coming from 'spawn-wrap' (a dependency of 'nyc', which is a dependency of 'tap'); both versions of the changed code should give the same results, but nah.
In my experiments I found that a number of things would make the tests pass (each on their own):
npm test
from Hyper terminal instead of Webstorm IDE's terminal or the normal Windows terminal (most confusing, since they all use the cmd.exe shell, and the environment variables were the exact same)nodeBinary
to'node'
instead of the full path to the node binary (which is whatprocess.argv[0]
equals here). But this could behave differently depending on the environment PATH.I'll make a reproduction repo and file a bug in tap (tap, not spawn-wrap, since I don't understand how it all works together) but I think this workaround is acceptable for us.
Feel free to merge or just take what I've learned 🥂