-
Notifications
You must be signed in to change notification settings - Fork 179
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
Karma: use a single webpack bundle for all tests #2887
Merged
Merged
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
Codecov Report
@@ Coverage Diff @@
## master #2887 +/- ##
===========================================
+ Coverage 69.23% 81.28% +12.04%
===========================================
Files 699 701 +2
Lines 11878 11908 +30
===========================================
+ Hits 8224 9679 +1455
+ Misses 3654 2229 -1425
|
Size Change: +6.44 kB (0%) Total Size: 1 MB
ℹ️ View Unchanged
|
dmmulroy
approved these changes
Jul 1, 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.
lgtm. Once this is merged I'll update my current branch to reflect the changes
This was referenced Jul 1, 2020
swissspidy
added
the
Type: Infrastructure
Changes impacting testing infrastructure or build tooling
label
Jul 1, 2020
swissspidy
changed the title
Karma: use a single WebPack bundle for all tests
Karma: use a single webpack bundle for all tests
Jul 1, 2020
swissspidy
approved these changes
Jul 1, 2020
swissspidy
added a commit
that referenced
this pull request
Jan 4, 2021
Only the 5.0.0-alpha version is compatible with webpack 5, and it does not support the alternative usage we’ve been using anymore. Reverts #2887 because of that.
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.
Summary
Create a single webpack bundle for all Karma tests per project.
Relevant Technical Choices
The initial configuration was done per test file. The alternative, instead recommends to combining all tests into a single bundle. This requires a single "weird"
karma-tests.cjs
file to combine all tests together (sort of like import-all-by-mask). However, this has a lot of performance benefits. The bundling is about 3x faster and memory requirements are significantly lower.There's one small drawback: the webpack import-all-by-mask regex can only work on a file name and not the full path. So, all karma test files should be named
*.karma.js
. In practice this was the case for all but 2 files.And there's one more nuance. For some reason, the old config was running some tests a few times. I guess somehow the related test files were being bundled together and repeated. Thus, before this pull request, the test run was reporting 105 tests and now it will report 83. I double-checked in the source tree, and indeed, we only have 83 Karma tests total. Thus the new numbers are correct and the old ones are wrong. This doesn't, of course, change the coverage since rerunning the same test twice doesn't add or remove covered lines.
User-facing changes
n/a
Testing Instructions
n/a
Fixes #2851