Skip to content

Conversation

@9aoy
Copy link
Contributor

@9aoy 9aoy commented Nov 10, 2025

Summary

support customize the chai config via chaiConfig configuration.

type ChaiConfig = {
  /**
   * @default false
   */
  includeStack: boolean;
  /**
   * @default true
   */
  showDiff: boolean;
  /**
   * @default 40
   */
  truncateThreshold: number;
};

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings November 10, 2025 11:06
@netlify
Copy link

netlify bot commented Nov 10, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 7742fe9
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/6911c73df0684900087f3c9c
😎 Deploy Preview https://deploy-preview-683--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
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 support for customizing Chai configuration options in rstest, allowing users to control assertion behavior such as truncate threshold, stack traces, and diff display.

  • Adds a new chaiConfig configuration option to the rstest config interface
  • Integrates chaiConfig throughout the runtime pipeline (config → worker → runtime)
  • Provides documentation in both English and Chinese for the new feature

Reviewed Changes

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

Show a summary per file
File Description
packages/core/src/types/config.ts Defines ChaiConfig type and adds it to RstestConfig interface
packages/core/src/types/worker.ts Includes chaiConfig in RuntimeConfig type
packages/core/src/pool/index.ts Passes chaiConfig from normalized config to runtime config
packages/core/src/runtime/api/expect.ts Adds setupChaiConfig function to apply config to chai
packages/core/src/runtime/api/index.ts Calls setupChaiConfig during runtime initialization
website/theme/components/ConfigOverview.tsx Adds chaiConfig to the output group in config overview
website/docs/en/config/test/_meta.json Adds chaiConfig entry to English docs navigation
website/docs/zh/config/test/_meta.json Adds chaiConfig entry to Chinese docs navigation
website/docs/en/config/test/chaiConfig.mdx English documentation for the new config option
website/docs/zh/config/test/chaiConfig.mdx Chinese documentation for the new config option
e2e/chaiConfigs/index.test.ts E2E test verifying chai config functionality
e2e/chaiConfigs/fixtures/rstest.config.ts Test fixture config using chaiConfig
e2e/chaiConfigs/fixtures/index.test.ts Test fixture that validates truncateThreshold behavior
examples/node/rstest.config.ts Simplifies example config by removing coverage settings
examples/node/package.json Adds separate test:coverage script

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

Comment on lines 38 to 39
"printConsoleTrace",
"onConsoleLog",
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

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

The ordering of printConsoleTrace and onConsoleLog is inconsistent between this file and the ConfigOverview.tsx file. In ConfigOverview.tsx (lines 60-62), the order is resolveSnapshotPath, onConsoleLog, printConsoleTrace, but here it's resolveSnapshotPath, printConsoleTrace, onConsoleLog. Consider matching the order in ConfigOverview.tsx for consistency.

Suggested change
"printConsoleTrace",
"onConsoleLog",
"onConsoleLog",
"printConsoleTrace",

Copilot uses AI. Check for mistakes.
Comment on lines 38 to 39
"printConsoleTrace",
"onConsoleLog",
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

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

The ordering of printConsoleTrace and onConsoleLog is inconsistent between this file and the ConfigOverview.tsx file. In ConfigOverview.tsx (lines 60-62), the order is resolveSnapshotPath, onConsoleLog, printConsoleTrace, but here it's resolveSnapshotPath, printConsoleTrace, onConsoleLog. Consider matching the order in ConfigOverview.tsx for consistency.

Suggested change
"printConsoleTrace",
"onConsoleLog",
"onConsoleLog",
"printConsoleTrace",

Copilot uses AI. Check for mistakes.
@9aoy 9aoy merged commit 16c214b into main Nov 10, 2025
23 checks passed
@9aoy 9aoy deleted the chai-config branch November 10, 2025 11:31
@9aoy 9aoy mentioned this pull request Nov 11, 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