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

test: add runner cache for better test performance #9449

Merged
merged 7 commits into from
Feb 26, 2025
Merged

Conversation

LingyuCoder
Copy link
Contributor

@LingyuCoder LingyuCoder commented Feb 25, 2025

Summary

  • Add runner cache to prevent reading files multiple times
  • Fix slow runtime diff regex
  • Use json files as snapshots to prevent building webpack assets which never change

Before:
image

After:
image


This pull request includes several changes to the rspack-test-tools package, focusing on improving the functionality and maintainability of the codebase. The key changes include modifications to the compareModules and parseModules functions, updates to the replaceRuntimeModuleName function, and enhancements to the Jest configuration.

Functionality Improvements:

  • compareModules and parseModules: Changed the data structures from Map to Record for better performance and consistency. [1] [2] [3]
  • replaceRuntimeModuleName: Updated the function to handle content replacement more effectively, including the addition of a new regex pattern and a mapping object for runtime module names. [1] [2]

Configuration Updates:

  • Jest configuration: Enabled caching based on the CI environment variable to optimize test performance.

Code Enhancements:

  • Added a new cachable option to the IBasicRunnerOptions interface.
  • Introduced a snapshot option in the ICompareOptions interface to support snapshot testing.

Code Cleanup:

  • Removed the checkBundleFiles function from diff.ts as it was no longer needed.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Feb 25, 2025
Copy link

netlify bot commented Feb 25, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 8190d9b
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/67bdbed0fbab6600085e18be

Copy link

codspeed-hq bot commented Feb 25, 2025

CodSpeed Performance Report

Merging #9449 will not alter performance

Comparing test/runner-cache (8190d9b) with main (ba7556d)

Summary

✅ 7 untouched benchmarks

@LingyuCoder LingyuCoder enabled auto-merge (squash) February 25, 2025 17:22
@LingyuCoder LingyuCoder requested a review from SyMind February 25, 2025 17:22
@LingyuCoder LingyuCoder merged commit 5fad2a1 into main Feb 26, 2025
31 checks passed
@LingyuCoder LingyuCoder deleted the test/runner-cache branch February 26, 2025 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants