Skip to content

test(rstest): migrate externals-loading config cases#2513

Draft
colinaaa wants to merge 1 commit into
lynx-family:mainfrom
colinaaa:externals-loading-rspack-test-tools-pr
Draft

test(rstest): migrate externals-loading config cases#2513
colinaaa wants to merge 1 commit into
lynx-family:mainfrom
colinaaa:externals-loading-rspack-test-tools-pr

Conversation

@colinaaa
Copy link
Copy Markdown
Collaborator

@colinaaa colinaaa commented Apr 23, 2026

Summary

  • migrate externals-loading-webpack-plugin from the legacy @lynx-js/test-tools case entry to @rspack/test-tools
  • move the package cases to test/configCases/** and replace legacy bundlePath configs with per-case findBundle() and beforeExecute() hooks
  • pin the package to the patched @rspack/test-tools@1.7.9 runner and align root ESLint ignores with migrated configCases/** fixtures

Test Plan

  • pnpm --filter @lynx-js/externals-loading-webpack-plugin test

Summary by CodeRabbit

Release Notes

  • Refactor

    • Migrated test infrastructure from @lynx-js/test-tools to @rspack/test-tools, restructuring test configuration and organization to align with updated testing framework standards.
  • Chores

    • Updated ESLint configuration to properly exclude test directories.
    • Updated documentation instructions for test migration guidelines.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 23, 2026

⚠️ No Changeset found

Latest commit: 327b221

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4ea7d4a9-bb00-4d3a-ad6b-317fe07b197e

📥 Commits

Reviewing files that changed from the base of the PR and between 7f6fc9c and 327b221.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (43)
  • .github/externals-loading-webpack-plugin.instructions.md
  • .github/webpack-rstest-migration.instructions.md
  • eslint.config.js
  • packages/webpack/externals-loading-webpack-plugin/package.json
  • packages/webpack/externals-loading-webpack-plugin/rstest.config.ts
  • packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/globalObject-customize/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/merge-fetchBundle-calls/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/merge-loadscript-calls/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/config.test.ts
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/async/index.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/async/rspack.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/async/test.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/filter-duplicate-externals/index.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/filter-duplicate-externals/rspack.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/filter-duplicate-externals/test.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/globalObject-customize/index.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/globalObject-customize/rspack.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/globalObject-customize/test.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/merge-fetchBundle-calls/index.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/merge-fetchBundle-calls/rspack.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/merge-fetchBundle-calls/test.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/merge-loadscript-calls/index.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/merge-loadscript-calls/rspack.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/merge-loadscript-calls/test.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/not-overrides-existed-externals/index.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/not-overrides-existed-externals/rspack.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/not-overrides-existed-externals/test.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/only-background-externals/index.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/only-background-externals/rspack.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/only-background-externals/test.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/only-main-thread-externals/index.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/only-main-thread-externals/rspack.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/only-main-thread-externals/test.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/sync/index.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/sync/rspack.config.js
  • packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/sync/test.config.js
💤 Files with no reviewable changes (10)
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/globalObject-customize/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/merge-loadscript-calls/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs
  • packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/merge-fetchBundle-calls/test.config.cjs

📝 Walkthrough

Walkthrough

This PR migrates the externals-loading-webpack-plugin test infrastructure from @lynx-js/test-tools to @rspack/test-tools. It removes legacy test files, updates dependencies, adds rstest configuration with environment variable exports, and replaces all test case configurations with new formats featuring beforeExecute() and findBundle() hooks.

Changes

Cohort / File(s) Summary
Documentation & ESLint Configuration
.github/externals-loading-webpack-plugin.instructions.md, .github/webpack-rstest-migration.instructions.md, eslint.config.js
Added migration instructions for preserving bundle coverage and ESLint root ignores; extended ESLint ignores to exclude configCases directories under test folders.
Test Framework Setup
packages/webpack/externals-loading-webpack-plugin/package.json, packages/webpack/externals-loading-webpack-plugin/rstest.config.ts
Removed @lynx-js/test-tools dependency, pinned @rspack/test-tools to 1.7.9; added rstest configuration with __dirname resolution and environment variables for test path exports.
Test Infrastructure Migration
packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts (deleted), packages/webpack/externals-loading-webpack-plugin/test/config.test.ts (new)
Removed legacy Lynx test runner; introduced new test runner using describeByWalk and createNormalCase from @rspack/test-tools.
Legacy Test Case Configs Removed
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/*/test.config.cjs
Deleted 8 legacy test configuration files defining bundlePath exports for: async, filter-duplicate-externals, globalObject-customize, merge-fetchBundle-calls, merge-loadscript-calls, not-overrides-existed-externals, only-background-externals, only-main-thread-externals, sync.
New Test Case Configurations
packages/webpack/externals-loading-webpack-plugin/test/configCases/externals-loading/.../index.js, .../test.config.js
Added 9 test case configuration pairs (for async, filter-duplicate-externals, globalObject-customize, merge-fetchBundle-calls, merge-loadscript-calls, not-overrides-existed-externals, only-background-externals, only-main-thread-externals, sync) with TypeScript type references and hooks exporting beforeExecute() (clearing global symbol state) and findBundle() (specifying bundle targets).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

platform:Web

Suggested reviewers

  • upupming
  • luhc228

Poem

🐰 A bundle of changes, old configs fly away,
New rstest hooks take charge of the day,
beforeExecute clears, findBundle reveals,
Two threads in harmony—that's the real deal!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: migrating externals-loading test config cases to use @rspack/test-tools.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@colinaaa colinaaa marked this pull request as draft April 23, 2026 04:30
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 327b2216b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pnpm-lock.yaml
Comment on lines 1811 to +1813
'@rspack/test-tools':
specifier: catalog:rspack
version: 1.5.6(@rspack/core@1.7.9(@swc/helpers@0.5.21))
specifier: 1.7.9
version: 1.7.9(patch_hash=a5d7fbe6cc7dd67734d2c853f52ed8099fdbaee9a311dd64b49a10acdfa929e2)(@rspack/core@1.7.9(@swc/helpers@0.5.21))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add missing lockfile snapshot for @rspack/test-tools 1.7.9

Update the lockfile so this importer entry points to a snapshot that actually exists. The importer now references @rspack/test-tools as 1.7.9(patch_hash=...), but pnpm-lock.yaml only contains snapshot entries for @rspack/test-tools@1.5.6(...) and no matching 1.7.9(...) snapshot, which makes the lockfile internally inconsistent and can break pnpm install --frozen-lockfile in CI.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant