Skip to content
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

👷‍♀️ [RUM-6424] Change webpack chunk config to speed up local unit tests #3057

Merged
merged 4 commits into from
Nov 5, 2024

Conversation

cy-moi
Copy link
Contributor

@cy-moi cy-moi commented Oct 7, 2024

Motivation

Running unit tests locally is slow because we build dependency bundles with every change. We should speed it up to improve the development experience.

Webpack automatically split chunks so not all chunks will be rebuilt. Currently we set it to false due to dependency issues between our bundles. But we don't need to rebuild everything all the time.

Changes

Add a 'scope' command to avoid rebuilding all bundles when running scoped unit tests.

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.66%. Comparing base (d2c974e) to head (80960df).
Report is 30 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3057      +/-   ##
==========================================
- Coverage   93.67%   93.66%   -0.02%     
==========================================
  Files         275      275              
  Lines        7610     7610              
  Branches     1707     1707              
==========================================
- Hits         7129     7128       -1     
- Misses        481      482       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cit-pr-commenter bot commented Oct 7, 2024

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 160.95 KiB 160.95 KiB 0 B 0.00%
Logs 56.00 KiB 56.00 KiB 0 B 0.00%
Rum Slim 109.53 KiB 109.53 KiB 0 B 0.00%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.001 0.001 -0.000
addaction 0.030 0.031 0.001
addtiming 0.001 0.001 -0.000
adderror 0.032 0.032 0.000
startstopsessionreplayrecording 0.888 0.865 -0.023
startview 0.970 0.973 0.003
logmessage 0.020 0.019 -0.001
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 7.29 KiB 9.67 KiB 2.38 KiB
addaction 39.11 KiB 39.01 KiB -100 B
addtiming 5.96 KiB 8.00 KiB 2.03 KiB
adderror 43.72 KiB 46.14 KiB 2.42 KiB
startstopsessionreplayrecording 4.29 KiB 5.50 KiB 1.21 KiB
startview 460.56 KiB 467.42 KiB 6.86 KiB
logmessage 39.25 KiB 40.27 KiB 1.02 KiB

🔗 RealWorld

@cy-moi cy-moi force-pushed the congyao/RUM-6424-speed-up-local-unit-test branch from f22c9c7 to 76c8a40 Compare October 7, 2024 15:47
@cy-moi cy-moi marked this pull request as ready for review October 7, 2024 17:20
@cy-moi cy-moi requested a review from a team as a code owner October 7, 2024 17:20
@@ -18,6 +18,7 @@ module.exports = function (config) {
},
webpack: {
...karmaBaseConf.webpack,
optimization: { runtimeChunk: false },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we only doing it for local unit tests?

Copy link
Contributor Author

@cy-moi cy-moi Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we run multiple times consecutively for cicd with watch option. This only speeds it up when we want to watch changes. BrowserStack unit tests would fail without splitChunk:false.

Somehow, even if we exclude `developer-extension` sources in
browser-stack karma configuration, they still end up in the bundle. In
those sources, we used a Regexp syntax unsupported in older browsers.

This commit work around this issue by using the `new RegExp` constructor
instead of the regexp syntax.
@cy-moi cy-moi changed the base branch from main to v6 November 5, 2024 14:55
@cy-moi
Copy link
Contributor Author

cy-moi commented Nov 5, 2024

Same as the developer-extension, rum-react is also failed to be excluded and we cannot make it compatible with IE. So let's merge this in v6 directly.

@cy-moi cy-moi merged commit 560f28e into v6 Nov 5, 2024
18 of 19 checks passed
@cy-moi cy-moi deleted the congyao/RUM-6424-speed-up-local-unit-test branch November 5, 2024 16:16
cy-moi added a commit that referenced this pull request Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants