fix: only filter experimental warnings by default#845
Merged
Conversation
Currently, if we use some experimental features of Node.js, such as `fs/promises`, it will display `ExperimentalWarning`. This is very annoying, so we should filter it out by default.
✅ Deploy Preview for rstest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines warning suppression in worker processes to only filter experimental warnings instead of suppressing all warnings. The previous implementation used --no-warnings flag which suppressed all Node.js warnings, while the new approach uses a custom require script to selectively filter only ExperimentalWarning types, allowing other important warnings to be displayed.
Key changes:
- Created a new CommonJS module (
rstestSuppressWarnings.cjs) that intercepts theprocess.emitmethod to filter outExperimentalWarningtypes - Replaced
--no-warningsflag with--requireflag pointing to the new suppression script - Added test coverage to verify that non-experimental warnings (like
MaxListenersExceededWarning) are still displayed whileExperimentalWarningis suppressed
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/pool/rstestSuppressWarnings.cjs | New module that selectively suppresses only ExperimentalWarning by intercepting process.emit |
| packages/core/src/pool/index.ts | Replaces --no-warnings flag with --require pointing to the suppression script |
| packages/core/rslib.config.ts | Adds copy configuration to include the new .cjs file in the build output |
| e2e/worker/index.test.ts | Adds test to verify warnings are handled correctly |
| e2e/worker/fixtures/node.warning.test.ts | Test fixture that triggers MaxListenersExceededWarning |
| e2e/worker/fixtures/worker.error.config.ts | Config fixture (appears unused) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
only filter experimental warnings by default.
Related Links
Checklist