Skip to content

Comments

test: streamline custom message tests#7027

Merged
chenjiahan merged 1 commit intomainfrom
custom_msg_test_0124
Jan 24, 2026
Merged

test: streamline custom message tests#7027
chenjiahan merged 1 commit intomainfrom
custom_msg_test_0124

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Jan 24, 2026

Summary

  • The dev test helper now returns the running dev server instance
  • Updated custom message test cases to use the new dev helper, resulting in less repetitive setup and teardown code

Related

Checklist

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

Copilot AI review requested due to automatic review settings January 24, 2026 07:57
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @chenjiahan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on improving the efficiency and clarity of end-to-end tests related to custom server messages. By modifying a core test helper to expose the development server instance, it enables a more streamlined approach to writing and maintaining tests that interact with the server, ultimately making the test suite more robust and easier to understand.

Highlights

  • Enhanced dev test helper: The dev test helper function now returns the running development server instance, allowing direct interaction with the server in tests.
  • Streamlined custom message tests: Existing end-to-end tests for custom server messages have been refactored to leverage the enhanced dev helper, significantly reducing boilerplate code for server setup and teardown.
  • Improved test readability and maintainability: The refactoring leads to more concise and readable test cases by abstracting common setup logic into the dev helper.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@cloudflare-workers-and-pages
Copy link

Deploying rsbuild with  Cloudflare Pages  Cloudflare Pages

Latest commit: b535cd4
Status: ✅  Deploy successful!
Preview URL: https://91042d09.rsbuild-v2.pages.dev
Branch Preview URL: https://custom-msg-test-0124.rsbuild-v2.pages.dev

View logs

Copy link
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 effectively streamlines the custom message tests by enhancing the dev test helper to return the dev server instance. This change significantly reduces boilerplate code in the test files, making them cleaner and easier to maintain. The use of copySrcDir and editFile helpers is also a great improvement over manual file system operations. My only suggestion is to consider adding an explicit assertion for the server instance in the tests to improve debuggability in case the dev helper fails to provide it.

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 refactors the custom message tests to use the enhanced dev helper function, which now returns the running dev server instance. This change eliminates repetitive setup and teardown boilerplate code.

Changes:

  • Modified dev helper to capture and return the dev server instance via onBeforeStartDevServer hook
  • Refactored custom message tests to use the new dev helper with built-in cleanup
  • Removed manual server creation, listener setup, and cleanup code from tests

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
e2e/helper/jsApi.ts Added RsbuildDevServer import, captured server via onBeforeStartDevServer hook, and included it in the return object
e2e/cases/javascript-api/server-custom-message/index.test.ts Refactored tests to use dev fixture instead of manual server creation and cleanup, utilizing new test helpers like copySrcDir and editFile

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

@chenjiahan chenjiahan merged commit d4e23fc into main Jan 24, 2026
13 checks passed
@chenjiahan chenjiahan deleted the custom_msg_test_0124 branch January 24, 2026 08:07
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