-
-
Notifications
You must be signed in to change notification settings - Fork 232
test: rename rsbuildConfig to config in test files #6246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this 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 renames the rsbuildConfig parameter to config in test files throughout the Rsbuild codebase to make the test code more concise and consistent. The change also adds backward compatibility by keeping rsbuildConfig as a deprecated alias.
- Updates all test files to use
configinstead ofrsbuildConfigwhen calling test utilities - Adds backward compatibility support for the deprecated
rsbuildConfigparameter - Updates type definitions to reflect the new parameter name with deprecation notices
Reviewed Changes
Copilot reviewed 173 out of 173 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/types/rsbuild.ts | Adds config parameter and marks rsbuildConfig as deprecated |
| packages/core/src/createRsbuild.ts | Updates parameter handling to support both config and rsbuildConfig |
| packages/core/src/cli/init.ts | Updates CLI initialization to use config parameter |
| e2e/helper/jsApi.ts | Updates test helper to use config parameter |
| packages/compat/webpack/tests/helper.ts | Updates webpack compatibility test helper |
| Multiple test files | Renames rsbuildConfig to config in test configurations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex Review: Here are some suggestions.
rsbuild/scripts/test-helper/src/index.ts
Lines 43 to 51 in de15642
| const rsbuildConfig = | |
| typeof options.rsbuildConfig === 'function' | |
| ? await options.rsbuildConfig() | |
| : options.rsbuildConfig || {}; | |
| const rsbuildOptions = { | |
| cwd: process.env.REBUILD_TEST_SUITE_CWD || process.cwd(), | |
| ...options, | |
| rsbuildConfig, |
[P1] Stub helper ignores new
config option
The tests were rewritten to pass their configuration through a config property, but createStubRsbuild still reads only options.rsbuildConfig when constructing the stub instance. Any options passed via config are now silently discarded and the tests run against an empty configuration. This breaks many unit tests that rely on custom settings (e.g. source entries, output tweaks) and makes the commit’s test suite fail or produce invalid assertions.
rsbuild/packages/core/tests/__snapshots__/default.test.ts.snap
Lines 1 to 47 in de15642
| // Rstest Snapshot v1 | |
| exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = ` | |
| { | |
| "context": "<ROOT>/packages/core/tests", | |
| "devtool": "cheap-module-source-map", | |
| "entry": { | |
| "index": [ | |
| "./src/index.js", | |
| ], | |
| }, | |
| "experiments": { | |
| "asyncWebAssembly": true, | |
| "inlineConst": false, | |
| "inlineEnum": false, | |
| "lazyBarrel": true, | |
| "rspackFuture": { | |
| "bundlerInfo": { | |
| "force": false, | |
| }, | |
| }, | |
| "typeReexportsPresence": true, | |
| }, | |
| "infrastructureLogging": { | |
| "level": "error", | |
| }, | |
| "lazyCompilation": { | |
| "entries": false, | |
| "imports": true, | |
| }, | |
| "mode": "development", | |
| "module": { | |
| "parser": { | |
| "javascript": { | |
| "exportsPresence": "error", | |
| "inlineConst": false, | |
| "typeReexportsPresence": "tolerant", | |
| }, | |
| }, | |
| "rules": [ | |
| { | |
| "resolve": { | |
| "fullySpecified": false, | |
| }, | |
| "test": /\\\\\\.m\\?js/, | |
| }, | |
| { |
[P1] Snapshot files deleted while tests still call
toMatchSnapshot
All Jest snapshots for the core package were removed (for example __snapshots__/default.test.ts.snap), yet the corresponding tests continue to use expect(...).toMatchSnapshot(). Without the snapshot files, pnpm test will immediately fail because Jest cannot find the stored expectations. Unless the tests are converted to inline snapshots or updated to assert differently, these snapshot files should not be deleted.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Summary
The commit renames all instances of
rsbuildConfigtoconfigin test files to make them shorter.Related Links
#6245
Checklist