Skip to content

test: remove useless global setup file#82

Merged
chenjiahan merged 5 commits intomainfrom
test-enhance
Feb 28, 2026
Merged

test: remove useless global setup file#82
chenjiahan merged 5 commits intomainfrom
test-enhance

Conversation

@9aoy
Copy link
Collaborator

@9aoy 9aoy commented Feb 28, 2026

remove useless global setup file.

Copilot AI review requested due to automatic review settings February 28, 2026 03:07
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 streamlines the project's test infrastructure by eliminating an unnecessary global test setup file and its corresponding dependencies. This change reduces the project's footprint, simplifies the test configuration, and ensures that only actively used packages are maintained.

Highlights

  • Dependency Removal: The tcp-port-used dependency has been removed from package.json and pnpm-lock.yaml, along with its associated transitive dependencies.
  • Test Setup Simplification: The global-setup-test.js file, which was deemed useless, has been deleted, and its reference removed from rstest.config.ts.
  • Configuration Update: The rstest.config.ts file was updated to correctly extract the webpack version from @rspack/core/package.json and to remove redundant test exclusion patterns.

🧠 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
  • package.json
    • Removed the tcp-port-used dependency.
  • pnpm-lock.yaml
    • Removed tcp-port-used and its transitive dependencies, including debug@4.3.1, deep-is@0.1.4, ip-regex@4.3.0, is-url@1.2.4, is2@2.0.9, and ms@2.1.2.
  • rstest.config.ts
    • Updated the method for extracting the webpack version from @rspack/core/package.json.
    • Removed the globalSetup configuration entry.
    • Cleaned up redundant exclude patterns for tests.
  • tests/helpers/global-setup-test.js
    • Deleted the file as it was no longer needed.
Activity
  • No specific activity has been recorded for this pull request since its creation.
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
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 successfully removes an unnecessary global setup file and its associated dependency, tcp-port-used. The logic for logging the version has been correctly relocated to rstest.config.ts, and the method for determining the webpack version for snapshots has been fixed. I have one suggestion to make the version extraction more robust for the future.

rstest.config.ts Outdated

const [webpackVersion] = rspackVersion;
const snapshotExtension = `.snap.webpack${webpackVersion}`;
const snapshotExtension = `.snap.webpack${webpackVersion[0]}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Using webpackVersion[0] to get the major version number is a bit fragile. This will not work correctly if the webpack major version reaches 10 or higher (it would extract '1' instead of '10'). A more robust approach would be to split the version string by . and take the first part.

Suggested change
const snapshotExtension = `.snap.webpack${webpackVersion[0]}`;
const snapshotExtension = `.snap.webpack${webpackVersion.split('.')[0]}`;

Copy link

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 removes an unused global test setup helper and cleans up related test configuration and dependencies.

Changes:

  • Deleted tests/helpers/global-setup-test.js and removed it from globalSetup in rstest.config.ts.
  • Moved the “running tests for …” version logging into rstest.config.ts and changed how the webpack version is sourced for snapshot naming.
  • Removed the unused tcp-port-used dev dependency and pruned it from the lockfile.

Reviewed changes

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

File Description
tests/helpers/global-setup-test.js Deletes an unused global setup script.
rstest.config.ts Removes globalSetup, adds version logging, and adjusts snapshot extension version logic.
package.json Drops tcp-port-used from devDependencies.
pnpm-lock.yaml Removes tcp-port-used and its transitive deps from the lockfile.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

rstest.config.ts:7

  • This log message says "rspack" but prints webpackVersion. That’s misleading when debugging test runs; either log the rspack version here or adjust the label to match the value being printed.
console.log(`Running tests for rspack @${webpackVersion} \n`);

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

@chenjiahan chenjiahan merged commit 1a67898 into main Feb 28, 2026
4 checks passed
@chenjiahan chenjiahan deleted the test-enhance branch February 28, 2026 07:32
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.

3 participants