Skip to content

test: migrate legacy e2e coverage - #132

Merged
chenjiahan merged 6 commits into
mainfrom
chenjiahan/migrate-legacy-e2e
Jul 25, 2026
Merged

chenjiahan merged 6 commits into
mainfrom
chenjiahan/migrate-legacy-e2e

Conversation

@chenjiahan

@chenjiahan chenjiahan commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR replaces the dormant Jest/Karton e2e-legacy suite with active Rstest coverage built on the Rspack Node API, plus Playwright for the asynchronous Rsbuild overlay.

It keeps the still-relevant behavior coverage, including configuration reloads, formatter integration, SolutionBuilder modes, tracing, watch add/change/delete/restore behavior, incremental package.json handling, production output, loader compatibility, package publishing, worker lifecycle, Rspack 1 compatibility, and the TypeScript 5.0 baseline. Obsolete Webpack-only and historical TypeScript matrices are removed.

This PR is test-only relative to main. The root-file runtime fix was split into and merged through #133.

Validation

  • pnpm lint
  • pnpm test — 27 files, 158 tests
  • Focused watch/package-contract tests — 8 tests
  • TypeScript 5.0 compatibility coverage
  • GitHub Actions — macOS, Ubuntu, Windows
  • CodeQL

@chenjiahan
chenjiahan marked this pull request as ready for review July 24, 2026 06:44

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

Copy link
Copy Markdown

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: a4917b1563

ℹ️ 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 src/typescript/worker/get-issues-worker.ts Outdated

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

Copy link
Copy Markdown

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: a4917b1563

ℹ️ 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 test/e2e/package-contract.test.ts Outdated
Comment thread src/typescript/worker/get-issues-worker.ts Outdated
@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@chenjiahan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 401c2e24-0071-47bc-8a99-5dd0cb35cf1a

📥 Commits

Reviewing files that changed from the base of the PR and between 64caab9 and c92cb34.

📒 Files selected for processing (10)
  • test/e2e/README.md
  • test/e2e/fixtures/basic/tsconfig.json
  • test/e2e/fixtures/project-references/tsconfig.base.json
  • test/e2e/helpers/rspack.ts
  • test/e2e/package-contract.test.ts
  • test/e2e/with-rspack/build-and-emit.test.ts
  • test/e2e/with-rspack/tracing.test.ts
  • test/e2e/with-rspack/watch.test.ts
  • test/unit/rpc/fixtures/restart-worker.cjs
  • test/unit/rpc/rpc-worker.spec.ts
📝 Walkthrough

Walkthrough

The legacy E2E suite is replaced with Rstest-based Rspack and Rsbuild tests, reusable temporary fixtures, compiler recorders, compatibility checks, watch coverage, build-output assertions, and package-contract validation. New fixtures cover basic compilation and TypeScript project references. Formatter tests now use real temporary files, worker-exit logging and RPC restart behavior gain unit coverage, and the mock-fs type dependency is removed.

🚥 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
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.
Title check ✅ Passed The title clearly summarizes the main change: migrating legacy e2e coverage.
Description check ✅ Passed The description matches the PR’s migration to Rstest/Rspack/Playwright coverage and removal of legacy Webpack tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chenjiahan/migrate-legacy-e2e

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (1)
test/e2e/with-rspack/build-and-emit.test.ts (1)

39-126: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding a default-mode case.

All four cases specify an explicit typescript.mode; there's no case exercising the plugin's default (unset mode) production behavior, which the PR description flags as a known coverage gap.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/with-rspack/build-and-emit.test.ts` around lines 39 - 126, Add a
test case to the existing SolutionBuilder artifact matrix that omits
`typescript.mode` and asserts the plugin’s default production artifact behavior,
including expected and absent paths. Keep the case within the existing
parameterized test and preserve the current explicit-mode cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/rpc/rpc-worker.ts`:
- Around line 77-90: Update the Object.defineProperties call for
remoteMethodProxy so connect, terminate, connected, and process retain the prior
enumerable, writable, and configurable property behavior from Object.assign
while preserving the live getter semantics for connected and process.

In `@test/e2e/fixtures/basic/tsconfig.json`:
- Line 5: Remove the TypeScript 6-only ignoreDeprecations setting from
test/e2e/fixtures/basic/tsconfig.json at lines 5-5 and
test/e2e/fixtures/project-references/tsconfig.base.json at lines 6-6, or replace
it with the documented TypeScript 5.0 value if suppression is required; keep
both TS 5.0 compatibility fixtures valid for typescript@5.0.4.

In `@test/e2e/package-contract.test.ts`:
- Around line 35-39: Update the pnpm invocations in the package-contract test,
including the shown pack call and the consumer install call, to use shell
execution so Windows resolves pnpm.cmd. Change the offline install flow to use
--prefer-offline or explicitly populate the pinned dependencies before
installing, ensuring the lockfile remains satisfiable without relying on cached
exact versions.

In `@test/e2e/with-rspack/tracing.test.ts`:
- Around line 32-40: Update the tracing test around getStatsMessages and
traceFiles to remove the unconditional types*.json assertion, retaining the
trace*.json event-trace assertion and existing error validation. Do not require
programmatic TypeScript trace catalog emission from
startTracing()/stopTracing().

In `@test/e2e/with-rspack/watch.test.ts`:
- Around line 260-277: Update the change-waiting logic around
recorder.waitForChangesAfter so it does not resolve on the first arbitrary
event. Collect or inspect all changes recorded after changeIndex, then assert
across the complete set that no changedFiles or deletedFiles entry ends with
package.json, ensuring the assertion validates the package/package.json edit
rather than an unrelated event.

In `@test/unit/rpc/rpc-worker.spec.ts`:
- Around line 34-37: The cleanup around worker.process should avoid awaiting a
close event after the process has already exited. In the test’s termination
flow, check exitCode/signalCode or reuse the earlier firstClose listener so only
a still-running process is awaited, while preserving cleanup for processes that
terminate during worker.terminate().

---

Nitpick comments:
In `@test/e2e/with-rspack/build-and-emit.test.ts`:
- Around line 39-126: Add a test case to the existing SolutionBuilder artifact
matrix that omits `typescript.mode` and asserts the plugin’s default production
artifact behavior, including expected and absent paths. Keep the case within the
existing parameterized test and preserve the current explicit-mode cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a9a8a01-8548-4bf3-bece-f980dfe34b70

📥 Commits

Reviewing files that changed from the base of the PR and between 31775e4 and a4917b1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (73)
  • package.json
  • src/rpc/rpc-worker.ts
  • src/typescript/worker/get-issues-worker.ts
  • src/typescript/worker/lib/program/watch-program.ts
  • test/e2e-legacy/driver/listener.ts
  • test/e2e-legacy/driver/webpack-dev-server-driver.ts
  • test/e2e-legacy/driver/webpack-errors-extractor.ts
  • test/e2e-legacy/fixtures/type-definitions/package.json
  • test/e2e-legacy/fixtures/type-definitions/rspack.config.ts
  • test/e2e-legacy/fixtures/type-definitions/tsconfig.json
  • test/e2e-legacy/fixtures/typescript-basic/package.json
  • test/e2e-legacy/fixtures/typescript-basic/rspack.config.js
  • test/e2e-legacy/fixtures/typescript-basic/src/authenticate.ts
  • test/e2e-legacy/fixtures/typescript-basic/src/index.ts
  • test/e2e-legacy/fixtures/typescript-basic/src/model/Role.ts
  • test/e2e-legacy/fixtures/typescript-basic/src/model/User.ts
  • test/e2e-legacy/fixtures/typescript-basic/tsconfig.json
  • test/e2e-legacy/fixtures/typescript-monorepo/package.json
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/client/package.json
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/client/src/index.ts
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/client/tsconfig.json
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/shared/package.json
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/shared/src/index.ts
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/shared/src/intersect.ts
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/shared/src/subtract.ts
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/shared/tsconfig.json
  • test/e2e-legacy/fixtures/typescript-monorepo/rspack.config.js
  • test/e2e-legacy/fixtures/typescript-monorepo/tsconfig.base.json
  • test/e2e-legacy/fixtures/typescript-package/package/index.d.ts
  • test/e2e-legacy/fixtures/typescript-package/package/index.js
  • test/e2e-legacy/fixtures/typescript-package/package/package.json
  • test/e2e-legacy/fixtures/webpack-node-api/webpack-node-api.js
  • test/e2e-legacy/jest.config.js
  • test/e2e-legacy/jest.environment.js
  • test/e2e-legacy/jest.setup.ts
  • test/e2e-legacy/out-of-memory-and-cosmiconfig.spec.ts
  • test/e2e-legacy/tsconfig.json
  • test/e2e-legacy/type-definitions.spec.ts
  • test/e2e-legacy/type-script-config.spec.ts
  • test/e2e-legacy/type-script-context-option.spec.ts
  • test/e2e-legacy/type-script-formatter-option.spec.ts
  • test/e2e-legacy/type-script-solution-builder-api.spec.ts
  • test/e2e-legacy/type-script-tracing.spec.ts
  • test/e2e-legacy/type-script-watch-api.spec.ts
  • test/e2e-legacy/webpack-inclusive-watcher.spec.ts
  • test/e2e-legacy/webpack-node-api.spec.ts
  • test/e2e-legacy/webpack-production-build.spec.ts
  • test/e2e/README.md
  • test/e2e/fixtures/basic/src/index.ts
  • test/e2e/fixtures/basic/src/math.ts
  • test/e2e/fixtures/basic/tsconfig.json
  • test/e2e/fixtures/project-references/packages/app/src/index.ts
  • test/e2e/fixtures/project-references/packages/app/tsconfig.json
  • test/e2e/fixtures/project-references/packages/shared/src/index.ts
  • test/e2e/fixtures/project-references/packages/shared/tsconfig.json
  • test/e2e/fixtures/project-references/tsconfig.base.json
  • test/e2e/fixtures/project-references/tsconfig.json
  • test/e2e/helpers/fixture.ts
  • test/e2e/helpers/rspack.ts
  • test/e2e/package-contract.test.ts
  • test/e2e/package.json
  • test/e2e/with-rsbuild/overlay.test.ts
  • test/e2e/with-rspack/build-and-emit.test.ts
  • test/e2e/with-rspack/config.test.ts
  • test/e2e/with-rspack/loader-compat.test.ts
  • test/e2e/with-rspack/tracing.test.ts
  • test/e2e/with-rspack/version-compat.test.ts
  • test/e2e/with-rspack/watch.test.ts
  • test/unit/formatter/code-frame-formatter.spec.ts
  • test/unit/formatter/formatter-config.spec.ts
  • test/unit/hooks/tap-error-to-log-message.spec.ts
  • test/unit/rpc/fixtures/restart-worker.cjs
  • test/unit/rpc/rpc-worker.spec.ts
💤 Files with no reviewable changes (45)
  • package.json
  • test/e2e-legacy/fixtures/typescript-basic/src/model/User.ts
  • test/e2e-legacy/fixtures/type-definitions/package.json
  • test/e2e-legacy/fixtures/type-definitions/tsconfig.json
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/shared/src/subtract.ts
  • test/e2e-legacy/webpack-inclusive-watcher.spec.ts
  • test/e2e-legacy/fixtures/typescript-basic/tsconfig.json
  • test/e2e-legacy/fixtures/typescript-basic/src/model/Role.ts
  • test/e2e-legacy/fixtures/typescript-basic/src/index.ts
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/client/package.json
  • test/e2e-legacy/webpack-node-api.spec.ts
  • test/e2e-legacy/fixtures/webpack-node-api/webpack-node-api.js
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/shared/tsconfig.json
  • test/e2e-legacy/fixtures/typescript-monorepo/tsconfig.base.json
  • test/e2e-legacy/fixtures/typescript-monorepo/rspack.config.js
  • test/e2e-legacy/fixtures/typescript-package/package/index.js
  • test/e2e-legacy/fixtures/typescript-basic/package.json
  • test/e2e-legacy/type-script-tracing.spec.ts
  • test/e2e-legacy/jest.config.js
  • test/e2e-legacy/driver/listener.ts
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/shared/package.json
  • test/e2e-legacy/driver/webpack-errors-extractor.ts
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/client/tsconfig.json
  • test/e2e-legacy/type-script-context-option.spec.ts
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/client/src/index.ts
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/shared/src/intersect.ts
  • test/e2e-legacy/fixtures/typescript-package/package/package.json
  • test/e2e-legacy/type-script-formatter-option.spec.ts
  • test/e2e-legacy/fixtures/typescript-basic/src/authenticate.ts
  • test/e2e-legacy/fixtures/type-definitions/rspack.config.ts
  • test/e2e-legacy/fixtures/typescript-monorepo/package.json
  • test/e2e-legacy/type-script-solution-builder-api.spec.ts
  • test/e2e-legacy/type-definitions.spec.ts
  • test/e2e-legacy/webpack-production-build.spec.ts
  • test/e2e-legacy/driver/webpack-dev-server-driver.ts
  • test/e2e-legacy/fixtures/typescript-basic/rspack.config.js
  • test/e2e-legacy/fixtures/typescript-monorepo/packages/shared/src/index.ts
  • test/e2e-legacy/out-of-memory-and-cosmiconfig.spec.ts
  • test/e2e-legacy/type-script-config.spec.ts
  • test/e2e-legacy/type-script-watch-api.spec.ts
  • test/e2e-legacy/jest.setup.ts
  • test/e2e-legacy/tsconfig.json
  • src/typescript/worker/lib/program/watch-program.ts
  • test/e2e-legacy/fixtures/typescript-package/package/index.d.ts
  • test/e2e-legacy/jest.environment.js

Comment thread src/rpc/rpc-worker.ts Outdated
Comment thread test/e2e/fixtures/basic/tsconfig.json Outdated
Comment thread test/e2e/package-contract.test.ts Outdated
Comment thread test/e2e/with-rspack/tracing.test.ts Outdated
Comment thread test/e2e/with-rspack/watch.test.ts
Comment thread test/unit/rpc/rpc-worker.spec.ts Outdated

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

Copy link
Copy Markdown

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: 66bf7df864

ℹ️ 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 test/e2e/with-rspack/watch.test.ts
…gacy-e2e

# Conflicts:
#	src/typescript/worker/get-issues-worker.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/package-contract.test.ts`:
- Around line 30-33: Update the package-manager execution helper around
execFileAsync so the Windows npm_execpath fallback is argument-safe: avoid
passing an argument array with shell enabled by using a safely quoted explicit
command or a resolved package-manager path. Add a regression test that unsets
npm_execpath and uses a temporary directory containing spaces, verifying the
package contract command succeeds.

In `@test/unit/rpc/rpc-worker.spec.ts`:
- Around line 5-21: Update waitForProcessExit and the surrounding RPC worker
test lifecycle to synchronize with the ChildProcess close/exit event rather than
relying solely on process.kill(pid, 0) returning ESRCH. Ensure the worker proxy
is cleared or the lifecycle completion is awaited before issuing a second
createRpcWorker call, so createRpcWorker cannot reuse a stale connected IPC
channel.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a974ca01-ddaa-4007-ac0f-c881f575aa6f

📥 Commits

Reviewing files that changed from the base of the PR and between a4917b1 and 64caab9.

📒 Files selected for processing (6)
  • test/e2e/package-contract.test.ts
  • test/e2e/with-rspack/config.test.ts
  • test/e2e/with-rspack/tracing.test.ts
  • test/e2e/with-rspack/watch.test.ts
  • test/unit/rpc/fixtures/restart-worker.cjs
  • test/unit/rpc/rpc-worker.spec.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • test/unit/rpc/fixtures/restart-worker.cjs
  • test/e2e/with-rspack/tracing.test.ts
  • test/e2e/with-rspack/config.test.ts
  • test/e2e/with-rspack/watch.test.ts

Comment thread test/e2e/package-contract.test.ts Outdated
Comment thread test/unit/rpc/rpc-worker.spec.ts Outdated
@chenjiahan
chenjiahan merged commit 2c9a279 into main Jul 25, 2026
6 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/migrate-legacy-e2e branch July 25, 2026 00:17
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.

1 participant