-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve watcher #475
Merged
Merged
Improve watcher #475
Conversation
This file contains 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
lydell
commented
Nov 28, 2020
harrysarson
reviewed
Nov 28, 2020
harrysarson
reviewed
Nov 28, 2020
As a bonus, functions are now either pure or side-effect-only without return values. It is very clear now how the compilation steps work.
lydell
commented
Dec 8, 2020
harrysarson
reviewed
Dec 10, 2020
harrysarson
reviewed
Dec 10, 2020
harrysarson
reviewed
Dec 10, 2020
harrysarson
reviewed
Dec 10, 2020
harrysarson
reviewed
Dec 10, 2020
harrysarson
reviewed
Dec 10, 2020
Just got runTests to go. Nearly there 🎉 |
harrysarson
approved these changes
Dec 17, 2020
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.
Happy!
I like the queuing a lot and thanks for the help finding which code had moved where. You ready for me to merge? |
I’m ready! |
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.
This makes the watcher faster and more stable! As a bonus, this made the code much more organized.
Concentrate all
process.exit
in elm-test.js (except one in Install.js where I found no clean solution). Besides making the code easier to follow, it allows the watcher to continue running (and recover) even if there are errors.Don’t crash/stop running tests if files are removed.
Pick up new Elm files added.
Fixes Watcher: Cancel previous compilation and test runs #225
We already had code for waiting for the previous run to finish before starting the next run, but it queued up every single file change/add/remove event and ran that many runs one after the other. Now, for all watch events during a run we run once after the current run for all of them. We also sleep 100 ms at the start of each run to catch more events happening close by (such as when adding/removing a whole folder of tests). (Note: We used to sleep at least 500 ms via the awaitWriteFinish chokidar option.)
I’ve also tested manually that running elm-format on save doesn’t cause double test runs: Cancel previous running compile process in watch mode #194
Fixes Error if run from a subdirectory #355
We now find the closest elm.json upwards in the folder hierarchy.
Resolves Fix watch for packages when there are compilation errors in src/ #453 (comment)
The watcher now listens for changes to elm.json and properly recalculates things. I thought that I would have to recalculate some things only when elm.json changes for performance, but after making the globbing faster there was no need so we simply rebuild everything on each run.
Closes Replace
new Promise
and.then
with async/await #463 and closes Moving to async/await: lib/Runner.js #464I can’t find any more places to use async/await.
elm.json is now decoded properly in one place rather than here and there and just being
any
. We now have 0 explicitany
type annotations!elm-test.js now only contains CLI logic and subcommand dispatching. The code for running tests have been moved to RunTests.js and to FindTests.js (which used to be called Runner.js).
Improved .flowconfig that is stricter. Closes Ban the flow
any
type. #478And lots of little code improvements along the way! I only touched things that I needed to change anyway in order to not make the diff balloon too much.
I’ve done some manual testing on Windows, Mac and Linux to make sure things work like they should.