Skip to content

feat: support output error message to stderr#758

Merged
9aoy merged 4 commits intomainfrom
stderr
Dec 11, 2025
Merged

feat: support output error message to stderr#758
9aoy merged 4 commits intomainfrom
stderr

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Dec 11, 2025

Summary

support output error message to stderr
image

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings December 11, 2025 06:47
@netlify
Copy link
Copy Markdown

netlify bot commented Dec 11, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 961c854
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/693a6cd8a81bde0008f7f5da
😎 Deploy Preview https://deploy-preview-758--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
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 implements proper separation of error output to stderr while keeping normal output on stdout. It adds a new stderr method to the logger that wraps console.error(), enabling test frameworks and CI/CD systems to distinguish between test results and error messages more effectively.

Key Changes

  • Added logger.stderr() method that outputs to stderr via console.error()
  • Migrated all error-related output (error messages, stack traces, code frames, failing test summaries) to use logger.stderr() instead of logger.log()
  • Updated test helpers to include expectStderrLog() for verifying error messages in stderr stream

Reviewed changes

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

Show a summary per file
File Description
packages/core/src/utils/logger.ts Renamed imported logger to rslog, added new stderr method to logger that outputs to console.error
packages/core/src/utils/error.ts Migrated error printing functions to use logger.stderr() for error messages, stack traces, and code frames
packages/core/src/reporter/utils.ts Changed test case errors to use logger.log() instead of console.error() for consistency
packages/core/src/reporter/summary.ts Updated failing test summary to output to stderr
packages/core/src/reporter/junit.ts Migrated error messages to logger.stderr() while keeping informational messages on stdout
packages/core/src/reporter/index.ts Added logic to route console logs to stdout or stderr based on log.type field
packages/core/src/reporter/githubActions.ts Replaced console.log() with logger.log() for consistency
packages/core/src/cli/prepare.ts Replaced console.log() with logger.log() for consistency
e2e/test-api/*.test.ts Updated tests to use expectStderrLog() for error message assertions
e2e/lifecycle/*.test.ts Updated tests to check stderr stream for error messages
e2e/expect/test/soft.test.ts Changed to read from stderr stream for error assertions
e2e/dom/*.test.ts Updated tests to use expectStderrLog() for error assertions
e2e/diff/index.test.ts Changed to read diff output from stderr
e2e/snapshot/diff.test.ts Changed to read diff output from stderr
e2e/log/trace.test.ts Updated to check stderr for console.error traces and use cli.log for combined output
e2e/setup/index.test.ts Updated to use expectStderrLog() for setup error assertions
e2e/runner/test/processKill.test.ts Updated to use expectStderrLog() for process kill error assertions
e2e/projects/index.test.ts Updated to use expectStderrLog() for error assertions
e2e/build/fixtures/plugin/rstest.config.ts Simplified import statement (unrelated cleanup)

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

9aoy and others added 2 commits December 11, 2025 14:58
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@9aoy 9aoy merged commit 1264699 into main Dec 11, 2025
16 checks passed
@9aoy 9aoy deleted the stderr branch December 11, 2025 07:11
@9aoy 9aoy mentioned this pull request Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants