Skip to content

test: migrate tests to rstest#21

Merged
LingyuCoder merged 4 commits intomainfrom
rstest
Feb 25, 2026
Merged

test: migrate tests to rstest#21
LingyuCoder merged 4 commits intomainfrom
rstest

Conversation

@9aoy
Copy link
Copy Markdown
Contributor

@9aoy 9aoy commented Feb 25, 2026

image

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @9aoy, 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 undertakes a comprehensive migration of the project's testing infrastructure from Jest to rstest. The changes span across various test files, updating their syntax and structure to be compatible with the new framework. This initiative aims to standardize the testing environment and leverage the features provided by rstest, ensuring a consistent and efficient testing workflow moving forward.

Highlights

  • Test Framework Migration: The project's test suite has been migrated from Jest to rstest, involving significant changes to test files and configurations.
  • Test File Syntax Updates: Numerous JavaScript test files have been updated to adopt rstest's testing primitives, including it, expect, describe, beforeEach, afterEach, and rstest utilities, often converting asynchronous tests to use async/await.
  • Snapshot Format Adjustment: Snapshot files (.snap) have been updated to align with the rstest snapshot format, reflecting changes in test naming conventions.
  • Dependency and Configuration Cleanup: Jest-specific configuration files (jest.config.cjs, patch-node-env.cjs, setupTestEnv.cjs) and related dependencies in package.json have been removed, replaced by a new rstest.config.ts file and @rstest/core dependency.
  • Rstest Configuration: A new rstest.config.ts file has been added to configure rstest, including setting test timeouts, snapshot format, and worker limits, specifically restricting css-extract tests to a single worker to prevent conflicts.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • copy-plugin/CopyPlugin.test.js
    • Updated test imports from Jest to rstest and converted test callbacks to use async/await syntax.
  • copy-plugin/snapshots/CopyPlugin.test.js.snap
    • Updated snapshot headers and adjusted test names to reflect the rstest format.
  • copy-plugin/helpers/run.js
    • Added an import for expect from @rstest/core.
  • css-extract/HMR.test.js
    • Removed Jest environment comment, updated imports to use rstest utilities, and converted test callbacks to async/await.
  • css-extract/TestCache.test.js
    • Removed Jest environment comment, updated imports to rstest, and replaced jest.clearAllMocks with rstest.clearAllMocks.
  • css-extract/TestCases.test.js
    • Removed Jest environment comment, updated imports to rstest, and changed global.updateSnapshot to process.env.UPDATE_SNAPSHOT.
  • css-extract/TestMemoryFS.test.js
    • Added rstest imports for describe, expect, and it.
  • css-extract/snapshots/HMR.test.js.snap
    • Updated snapshot headers, adjusted test names to rstest format, and modified a URL in a snapshot.
  • css-extract/snapshots/attributesOption.test.js.snap
    • Updated snapshot headers and adjusted test names to reflect the rstest format.
  • css-extract/snapshots/emitOption.test.js.snap
    • Updated snapshot headers and adjusted test names to reflect the rstest format.
  • css-extract/snapshots/insertOption.test.js.snap
    • Updated snapshot headers and adjusted test names to reflect the rstest format.
  • css-extract/snapshots/linkTagOption.test.js.snap
    • Updated snapshot headers and adjusted test names to reflect the rstest format.
  • css-extract/snapshots/runtimeOption.test.js.snap
    • Updated snapshot headers and adjusted test names to reflect the rstest format.
  • css-extract/snapshots/validate-loader-options.test.js.snap
    • Updated snapshot headers and removed several specific snapshot entries.
  • css-extract/snapshots/validate-plugin-options.test.js.snap
    • Updated snapshot headers and removed several specific snapshot entries.
  • css-extract/attributesOption.test.js
    • Added rstest imports for describe, expect, and it.
  • css-extract/emitOption.test.js
    • Added rstest imports and updated it descriptions to use single quotes.
  • css-extract/enforceEsm.test.js
    • Added rstest imports for expect and it.
  • css-extract/ignoreOrderOption.test.js
    • Added rstest imports for describe, expect, and it.
  • css-extract/insertOption.test.js
    • Added rstest imports for describe, expect, and it.
  • css-extract/linkTagOption.test.js
    • Added rstest imports for describe, expect, and it.
  • css-extract/normalizeUrl.test.js
    • Added rstest imports for describe, expect, and it.
  • css-extract/runtimeOption.test.js
    • Added rstest imports for describe, expect, and it.
  • css-extract/stringifyLocal.test.js
    • Added rstest imports and adjusted snapshot content for function stringification.
  • css-extract/validate-loader-options.test.js
    • Added rstest imports for describe, expect, and it.
  • css-extract/validate-plugin-options.test.js
    • Added rstest imports for describe, expect, and it.
  • html-plugin/basic.test.js
    • Updated imports to rstest utilities, converted testHtmlPlugin to return a Promise, and updated numerous test calls to use async/await.
  • jest.config.cjs
    • Removed Jest configuration file.
  • package.json
    • Updated test and testu scripts to use rstest commands, added @rstest/core dependency, and removed various Jest-related dependencies.
  • patch-node-env.cjs
    • Removed Jest environment patching file.
  • rstest.config.ts
    • Added new rstest configuration file with project-specific settings.
  • setupTestEnv.cjs
    • Removed Jest setup file.
  • sri-plugin/examples.test.js
    • Updated imports and replaced jest.setTimeout with rstest.setConfig.
  • sri-plugin/hwp-error.test.js
    • Updated imports and replaced jest.unstable_mockModule with rstest.mock.
  • sri-plugin/integration.test.js
    • Updated imports and commented out jest.unmock for rstest.unmock.
  • sri-plugin/unit.test.js
    • Updated imports and commented out jest.unmock for rstest.unmock.
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.

Copy link
Copy Markdown

@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 successfully migrates the entire test suite from Jest to rstest. The changes are extensive and well-executed, including updating test scripts, configurations, and refactoring asynchronous tests to use async/await instead of done callbacks.

I have a couple of suggestions for further improving the test suite's maintainability and performance:

  • In html-plugin/basic.test.js, the helper function testHtmlPlugin has complex argument handling that could be simplified.
  • In rstest.config.ts, the tests are configured to run serially. A suggestion is made to improve test isolation to enable parallel execution in the future.

Overall, this is a solid migration that modernizes the testing setup.

Comment thread html-plugin/basic.test.js
Comment thread rstest.config.ts Outdated
@9aoy 9aoy requested a review from LingyuCoder February 25, 2026 08:34
@LingyuCoder LingyuCoder merged commit 17c8a3a into main Feb 25, 2026
3 checks passed
@LingyuCoder LingyuCoder deleted the rstest branch February 25, 2026 08:38
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