Producing a single test bundle
See original GitHub issueIf I add preprocessors: {'**/*_test.js': ['webpack']}
and I have 100s of tests, that produces 100s of large bundles - that’s slow, reruns tests all the time since karma keeps detecting changes and rerunning all ests as each test bundle is produced by webpack and this sends many megabytes to the test browser to evaluate.
Instead, if I add preprocessors: {"test_index.js": ['webpack']}
and require all my tests in that file (e.g. here then webpack produces 1 test bundle. However, now I have to manually maintain the full list of all my tests which doesn’t scale.
I don’t know enough about karma plugins or webpack yet, but do you reckon there’s a way to configure webpack/karma/karma-webpack to produce ony 1 test bundle from a pattern such as **/*_test.js
?
Perhaps something like dynamically, via the karma-webapck plugin, adding configuration about which modules to force include even if they’re not required (is there such option?)
Issue Analytics
- State:
- Created 9 years ago
- Reactions:4
- Comments:19 (5 by maintainers)
I should mention that the one down-side to this technique that I’ve noticed is that it breaks
watch
mode for subsequently required files — only thetest_index
will trigger a karma rebuild.Edit: I am an idiot 😃
This works perfectly…
I’m having the following issue: Karma detects file changes, but executes the old version of the file. Terminating and restarting karma causes the changed version of the file to be executed.