Skip to content

test(e2e): add loadBundle CJS runner coverage#7486

Merged
chenjiahan merged 2 commits intomainfrom
chenjiahan/test-load-bundle-cjs-e2e
Apr 13, 2026
Merged

test(e2e): add loadBundle CJS runner coverage#7486
chenjiahan merged 2 commits intomainfrom
chenjiahan/test-load-bundle-cjs-e2e

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

  • add a focused server e2e case for environments.node.loadBundle() on a CommonJS bundle
  • verify the loaded bundle can run with dynamic import() and access runner-provided globals like queueMicrotask
  • keep the case minimal by checking the /check response and the existing bundle cache behavior

Related Links

Copilot AI review requested due to automatic review settings April 13, 2026 05:47
Copy link
Copy Markdown
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

Adds a new focused server e2e case to validate environments.node.loadBundle() behavior intended for CommonJS bundles, including dynamic import() execution and bundle caching.

Changes:

  • Introduce a new load-bundle-cjs server e2e case with a /check route that loads and executes a node bundle via loadBundle().
  • Add a CJS server entry that uses dynamic import('node:path') and checks runtime globals (queueMicrotask).
  • Add an e2e test asserting the /check response and that the loaded bundle is cached (top-level log occurs once).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
e2e/cases/server/load-bundle-cjs/src/index.server.cjs New CJS server entry used as the node environment bundle for loadBundle() execution.
e2e/cases/server/load-bundle-cjs/src/index.js Minimal web entry for the case.
e2e/cases/server/load-bundle-cjs/rsbuild.config.ts Adds dev-only middleware that calls server.environments.node.loadBundle('index') and returns payload from the loaded bundle.
e2e/cases/server/load-bundle-cjs/index.test.ts Verifies response correctness and bundle caching via log count.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread e2e/cases/server/load-bundle-cjs/rsbuild.config.ts
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: e4805a916a

ℹ️ 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 e2e/cases/server/load-bundle-cjs/rsbuild.config.ts
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new E2E test case to verify the loading of CommonJS bundles with runtime globals in a server environment. However, the review feedback identifies a significant issue where the test does not actually exercise the CommonJS runner as intended; the underlying BasicRunnerFactory is currently hardcoded to always return the EsmRunner, meaning the factory logic needs to be updated to select the appropriate runner based on the file extension.

Comment thread e2e/cases/server/load-bundle-cjs/index.test.ts
@chenjiahan chenjiahan merged commit be95173 into main Apr 13, 2026
5 checks passed
@chenjiahan chenjiahan deleted the chenjiahan/test-load-bundle-cjs-e2e branch April 13, 2026 06:09
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.

2 participants