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.
First, let's see this in action.
Manually re-run the tests with the (new)
R
keyRe-run.tests.mp4
Automatically re-run the tests on file change
Watch.changes.mp4
Notes
To add support for the
R
key, there were not so many changes (even though the diff shows there are many):else
block, which is why it looks like I've changed a lot.To add support for the watch mode, I used the
chokidar
Node module. As the moduleREADME.md
explains, it normalizes watch events on different platforms and fixes some other issues with the built-infs.watch
andfs.watchFile
.Even though we ensure that we work with fresh copies of tests, our workaround does not cover another issue. If tests have one entry point (e.g.,
index.js
), and this file imports all other files with tests, we get files from the cache again on every re-run of the tests.So, this MVP works in simple cases (and might be used as a starting point), and I would love for us to discuss how to make it work in general.
I looked at how this functionality is implemented in Rollup. It looks like they have implemented their own cache system.