feat: support customize the chai config via chaiConfig configuration.#683
feat: support customize the chai config via chaiConfig configuration.#683
chaiConfig configuration.#683Conversation
✅ 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 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
chaiConfigconfiguration option to the rstest config interface - Integrates
chaiConfigthroughout 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.
| "printConsoleTrace", | ||
| "onConsoleLog", |
There was a problem hiding this comment.
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.
| "printConsoleTrace", | |
| "onConsoleLog", | |
| "onConsoleLog", | |
| "printConsoleTrace", |
| "printConsoleTrace", | ||
| "onConsoleLog", |
There was a problem hiding this comment.
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.
| "printConsoleTrace", | |
| "onConsoleLog", | |
| "onConsoleLog", | |
| "printConsoleTrace", |
Summary
support customize the chai config via
chaiConfigconfiguration.Related Links
Checklist