Skip to content

test: clean full snapshoted stats api test cases#10204

Merged
chenjiahan merged 2 commits intomainfrom
test/stats-snapshot
Apr 27, 2025
Merged

test: clean full snapshoted stats api test cases#10204
chenjiahan merged 2 commits intomainfrom
test/stats-snapshot

Conversation

@LingyuCoder
Copy link
Contributor

Summary

Using stats output instead of full snapshot to test stats

Checklist

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

@netlify
Copy link

netlify bot commented Apr 27, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit c0e3209
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/680db03ceca38b00089a44cf

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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;

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

codspeed-hq bot commented Apr 27, 2025

CodSpeed Performance Report

Merging #10204 will not alter performance

Comparing test/stats-snapshot (c0e3209) with main (97ac6fc)

Summary

✅ 11 untouched benchmarks

Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

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

👍

@chenjiahan chenjiahan merged commit 0fcb4e8 into main Apr 27, 2025
38 checks passed
@chenjiahan chenjiahan deleted the test/stats-snapshot branch April 27, 2025 05:19
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.

3 participants