test: clean full snapshoted stats api test cases#10204
Merged
chenjiahan merged 2 commits intomainfrom Apr 27, 2025
Merged
Conversation
✅ Deploy Preview for rspack canceled.
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates several stats API test cases by replacing full inline snapshot comparisons with more tailored string-based or property-based expectations.
- Refactored inline snapshot tests to use explicit string expectations and object comparisons.
- Simplified and standardized the test outputs across nested modules, errors, chunks, chunk groups, child compilers, build-time execution, and asset info.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/rspack-test-tools/tests/statsAPICases/nested-modules.js | Removed detailed inline snapshot in favor of checking a string pattern for concatenated module output. |
| packages/rspack-test-tools/tests/statsAPICases/error-chunk.js | Replaced snapshot matching for error messages with string containment checks. |
| packages/rspack-test-tools/tests/statsAPICases/chunks.js | Switched from inline snapshot validation to multiple toContain checks for verifying chunk output details. |
| packages/rspack-test-tools/tests/statsAPICases/chunk-group.js | Simplified chunk group tests by comparing expected string fragments instead of full JSON snapshots. |
| packages/rspack-test-tools/tests/statsAPICases/child-compiler.js | Updated child-compiler test to validate asset names and children in a sorted, explicit manner. |
| packages/rspack-test-tools/tests/statsAPICases/build-time-executed.js | Modified tests to compare sorted module identifiers through inline snapshots. |
| packages/rspack-test-tools/tests/statsAPICases/build-time-executed-runtime.js | Changed runtime test to validate the number and identifiers of runtime modules with sorted comparisons. |
| packages/rspack-test-tools/tests/statsAPICases/asset-info.js | Replaced inline asset snapshot with a manual sort and comparison of asset info properties. |
Comments suppressed due to low confidence (4)
packages/rspack-test-tools/tests/statsAPICases/nested-modules.js:24
- [nitpick] The removal of the inline snapshot here reduces the explicit property checks on the nested module. Consider ensuring that the new string-based expectation fully covers all key properties previously validated.
expect(concatedModule.modules).toMatchInlineSnapshot(` ... `);
packages/rspack-test-tools/tests/statsAPICases/chunks.js:37
- [nitpick] Using multiple toContain checks for chunk details is more flexible but might miss subtle changes. Please verify that all critical aspects (like sizes, names, and statuses) are fully covered by these expectations.
const string = stats.toString({
packages/rspack-test-tools/tests/statsAPICases/build-time-executed-runtime.js:45
- [nitpick] The runtime modules test now verifies the sorted list of identifiers and expects a fixed count. Ensure that future additions to runtime modules or changes in their order will not cause unexpected test failures.
webpack/runtime/compat_get_default_export,
packages/rspack-test-tools/tests/statsAPICases/asset-info.js:32
- [nitpick] Sorting assets and mutating the fullhash values stabilizes the test, but double-check that this mutation does not interfere with other tests that may rely on unaltered asset data.
const assets = stats?.toJson(statsOptions).assets;
CodSpeed Performance ReportMerging #10204 will not alter performanceComparing Summary
|
This file contains hidden or 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
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
Using stats output instead of full snapshot to test stats
Checklist