Conversation
✅ Deploy Preview for rstest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
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
disableConsoleInterceptis enabled - Adds a new section demonstrating how to silence all console logs by returning
falsefrom theonConsoleLoghandler - 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.
| ## 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, | ||
| }); | ||
| ``` |
There was a problem hiding this comment.
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:
- Clarifying that this is an edge case for completely disabling console output
- Providing a more practical example that demonstrates selective silencing (e.g., filtering specific third-party library logs)
| ## 静默控制台日志 | ||
|
|
||
| 你可以通过在 `onConsoleLog` 处理函数中返回 `false` 来静默控制台日志。 | ||
|
|
||
| ```ts title="rstest.config.ts" | ||
| import { defineConfig } from '@rstest/core'; | ||
| export default defineConfig({ | ||
| onConsoleLog: () => false, | ||
| }); | ||
| ``` |
There was a problem hiding this comment.
新增部分提供的示例与引言中描述的目的相矛盾。引言将 onConsoleLog 描述为"有助于过滤来自第三方库的日志",并提供了选择性过滤日志的示例。然而,新增部分展示的是无条件静默所有控制台日志,这与过滤的目的相悖。建议:
- 明确说明这是完全禁用控制台输出的边缘用例
- 提供更实用的示例来演示选择性静默(例如,过滤特定第三方库的日志)
Summary
update
onConsoleLogusage.Related Links
Checklist