-
Notifications
You must be signed in to change notification settings - Fork 222
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
When karma is auto-watching files, karma-webpack causes tests to occasionally run twice, possibly OS X-only #44
Comments
What if you add timeout ~ 400ms for watcher ? |
Thanks, @ColCh. Bumping Any ideas what about karma-webpack might trigger a change? Would just opening the JS files for reading be enough to cause it? |
FWIW, this very same problem was reported in nikku/karma-browserify#67. The comment from @mattyfsh seems to have resolved the issue for me. |
This prevents specs from running twice every time a file changes, because the webpack already triggers a rerun when recompiled. Thanks to this comment: codymikol#44 (comment)
See codymikol/karma-webpack#44 for root cause issue. I cribbed the fix from dvdzkwsk/react-redux-starter-kit#246.
Issue has multiple resolutions. Resolving |
This prevents specs from running twice every time a file changes, because the webpack already triggers a rerun when recompiled. Thanks to this comment: codymikol#44 (comment)
* Do not let karma watch files This prevents specs from running twice every time a file changes, because the webpack already triggers a rerun when recompiled. Thanks to this comment: #44 (comment) * Removed array wrapping and default options * Removed extra colon
I got my config to work (it no longer runs tests twice) based on the browserify example mentioned above. Here it is for clarity:
|
The cause for this is not clearly understood. However, the hypothesis is that karma and webpack both are watching the files. The fix seems to be the same as presented here: codymikol/karma-webpack#44
I have a larger project set up using gulp with karma's watch to run tests on the fly.
I noticed that frequently when making updates to test files karma is watching, the tests get fired twice. After paring down my configurations, it looks like karma-webpack is the culprit.
I'm on OS X, so hopefully the repro works on whatever platform. Here are instructions/a barebones repo to isolate the issue and reproduce:
https://github.com/alanctkc/karma-webpack-watch-bug-repro#readme
Here's a comparison of the output I get simulating changes with and without the
['webpack']
preprocessor:https://gist.github.com/alanctkc/79c2c4586f13f22bd8e6
Unfortunately, it doesn't seem to be super deterministic, so you might have to simulate changes a few times before seeing any duplicates. But, when the preprocessor is removed, there never seem to be any duplicate runs at all.
Any ideas?
The text was updated successfully, but these errors were encountered: