Draft
Conversation
See https://github.com/sindresorhus/import-fresh#esm The author of this snippet stated that it causes memory leaks, so this method needs to be used with caution.
✅ Deploy Preview for h-test ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Member
|
I think we need to split this into a separate PR for the r key, which is already a huge ergonomics improvement and much easier to implement than a watch mode, and a separate PR for the watch mode. We should probably keep track of how many times the tests have been rerun, that's useful data, and could also simplify the code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)
RkeyRe-run.tests.mp4
Automatically re-run the tests on file change
Watch.changes.mp4
Notes
To add support for the
Rkey, there were not so many changes (even though the diff shows there are many):elseblock, which is why it looks like I've changed a lot.To add support for the watch mode, I used the
chokidarNode module. As the moduleREADME.mdexplains, it normalizes watch events on different platforms and fixes some other issues with the built-infs.watchandfs.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.