Skip to content

Comments

test: reset logger level after each test#7015

Merged
chenjiahan merged 2 commits intomainfrom
reset_log_level_0122
Jan 22, 2026
Merged

test: reset logger level after each test#7015
chenjiahan merged 2 commits intomainfrom
reset_log_level_0122

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Jan 22, 2026

Summary

Adds an afterEach hook to reset logger.level to 'info' after each test, ensuring logger state does not leak between tests.

Checklist

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

Copilot AI review requested due to automatic review settings January 22, 2026 14:09
@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 introduces a cleanup step in the hmr/log-level test suite. By resetting the logger level after each test, it prevents potential interference between tests and ensures a consistent testing environment.

Highlights

  • Test Environment: The logger level is reset to 'info' after each test case in the hmr/log-level suite to ensure consistent test environments.
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

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 adds cleanup logic to reset the global logger level after each test in the HMR log-level test suite, preventing test pollution from persisting logger state modifications.

Changes:

  • Added test.afterEach hook to reset logger level to 'info' after each test
  • Imported the logger from '@rsbuild/core' to enable the reset

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

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 introduces a test.afterEach hook to reset the logger level in e2e/cases/hmr/log-level/index.test.ts. This is a good practice to improve test isolation and prevent state from one test leaking into another. I've added one suggestion to make this reset logic more robust by saving and restoring the original logger level, rather than hardcoding it to 'info'. This will make the tests more resilient to different environments, such as when running in debug mode.

@cloudflare-workers-and-pages
Copy link

Deploying rsbuild-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: b9723f2
Status: ✅  Deploy successful!
Preview URL: https://13de3dca.rsbuild-v2.pages.dev
Branch Preview URL: https://reset-log-level-0122.rsbuild-v2.pages.dev

View logs

@chenjiahan chenjiahan merged commit 8ccca9f into main Jan 22, 2026
7 of 10 checks passed
@chenjiahan chenjiahan deleted the reset_log_level_0122 branch January 22, 2026 14:29
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