Skip to content

docs: update onConsoleLog usage#810

Merged
9aoy merged 1 commit intomainfrom
docs/onConsoleLog
Dec 29, 2025
Merged

docs: update onConsoleLog usage#810
9aoy merged 1 commit intomainfrom
docs/onConsoleLog

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Dec 29, 2025

Summary

update onConsoleLog usage.

Related Links

Checklist

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

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

netlify bot commented Dec 29, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit d8b14cf
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/69521b6513d5850008fe0f4f
😎 Deploy Preview https://deploy-preview-810--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 updates the onConsoleLog documentation to improve clarity and provide additional usage examples. The changes affect both English and Chinese documentation files.

  • Updates wording from "will be ignored" to "will not take effect" for better clarity when disableConsoleIntercept is enabled
  • Adds a new section demonstrating how to silence all console logs by returning false from the onConsoleLog handler
  • Applies consistent changes across both English and Chinese documentation

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
website/docs/en/config/test/on-console-log.mdx Rephrases note about disableConsoleIntercept interaction and adds new "Silencing console logs" section with example
website/docs/zh/config/test/on-console-log.mdx Chinese version: Updates note wording and adds "静默控制台日志" section with example
website/docs/en/config/test/print-console-trace.mdx Rephrases note to use "will not take effect" instead of "will be ignored"
website/docs/zh/config/test/print-console-trace.mdx Chinese version: Updates note to use "将不会生效" instead of "将被忽略"

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

Comment on lines +22 to +31
## Silencing console logs

You can silence console logs by returning `false` in the `onConsoleLog` handler.

```ts title="rstest.config.ts"
import { defineConfig } from '@rstest/core';
export default defineConfig({
onConsoleLog: () => false,
});
```
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

The new section provides an example that contradicts the purpose stated in the introduction. The introduction describes onConsoleLog as "helpful for filtering out logs from third-party libraries" with an example that selectively filters logs. However, the new section shows silencing all console logs unconditionally, which defeats the filtering purpose. Consider either:

  1. Clarifying that this is an edge case for completely disabling console output
  2. Providing a more practical example that demonstrates selective silencing (e.g., filtering specific third-party library logs)

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +31
## 静默控制台日志

你可以通过在 `onConsoleLog` 处理函数中返回 `false` 来静默控制台日志。

```ts title="rstest.config.ts"
import { defineConfig } from '@rstest/core';
export default defineConfig({
onConsoleLog: () => false,
});
```
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

新增部分提供的示例与引言中描述的目的相矛盾。引言将 onConsoleLog 描述为"有助于过滤来自第三方库的日志",并提供了选择性过滤日志的示例。然而,新增部分展示的是无条件静默所有控制台日志,这与过滤的目的相悖。建议:

  1. 明确说明这是完全禁用控制台输出的边缘用例
  2. 提供更实用的示例来演示选择性静默(例如,过滤特定第三方库的日志)

Copilot uses AI. Check for mistakes.
@9aoy 9aoy merged commit 6222e58 into main Dec 29, 2025
23 checks passed
@9aoy 9aoy deleted the docs/onConsoleLog branch December 29, 2025 06:14
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