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
Watcher should only recompile changed files, and its dependents. #28
Comments
Figure 1: Submodules: A, B So, the custom watcher should take more time, because it’s processing more files. Our goal is to ensure the updated file—and its dependents downstream—are processed again. Ideally, we'd recompile only the changed file, and its descendants… so if B changes, then 1, 3, T1, and T2 are recompiled. This is exactly what version 3 does, except that it unintentionally re-ran tests for each processed file (#17). That means in the example above, the tests would have ran 5 times after changing B. Aside from spamming your terminal, Karma would encounter errors and false negatives. So |
While I completely agree with your info graphics, I'm not sure what I see locally corresponds to what you're saying. Saving a single Running all tests is not an issue, you can always limit only desired set of tests using something like 'fdescribe'. Edit: I have created a demo project for this: https://github.com/Paulskit/rollup-karma-performance-bug Steps to reproduce:
As you can see, on every translate file change (which has no external dependencies) you see warnings in console about not used dependencies. Those are coming from the |
I appreciate the reproduction, but the current behavior is by design. I agree it has room for improvement—but there are constraints when integrating with Karma, and the current file watcher is the first one that:
The cost is performance. Pull requests are welcome, but I will do my best to improve it. |
Clear enough. Thank you. |
For anyone encountering this, here's my solution: create a test manifest that explicitly imports every spec in your test suite, and put only that single entry-point in the Karma config. Watch tasks are much faster, due to the single compilation. Presumably this is something that could be automated as part of the preprocessor, but is easy enough to maintain as an additional module in the test suite itself. |
Default behavior for karma is to trigger processing only on changed file. This is very fast and convenient if you debug tests in watch mode.
Current implementation forces all files to be processed on any file change. Consequently, it takes a lot of time on large tests amount just to check 1 file change.
Just an example:
Default karma file watch + rollup
30 08 2017 15:18:36.617:INFO [watcher]: Changed file "./test/unit/behavior/noResultsBehavior.spec.js".
30 08 2017 15:18:36.791:INFO [watcher]: Changed file "./test/unit/behavior/noResultsBehavior.spec.js".
Less than 200ms to recompile and trigger test run.
Current implementation with custom watcher:
75 seconds to respond to single file change. (66 files and 564 tests recompiled in total)
The text was updated successfully, but these errors were encountered: