test(e2e): remove redundant cwd declarations - #6311
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.
Pull Request Overview
Removes redundant cwd usage in E2E tests to rely on the test context, and switches entry paths to relative strings for simplicity.
- Drop hardcoded cwd declarations and stop passing cwd into build/buildPreview
- Update entries from join(cwd, 'src/...') to './src/...'
- Destructure cwd from test context only where file operations require it
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| e2e/cases/server/public-dir/publicDir.test.ts | Remove local cwd and stop passing it to build/buildPreview; keep path operations using __dirname. |
| e2e/cases/server/public-dir-with-template/index.test.ts | Remove cwd and call buildPreview without cwd. |
| e2e/cases/server/public-dir-with-multi-template/index.test.ts | Remove cwd and call buildPreview without cwd. |
| e2e/cases/server/print-urls/index.test.ts | Remove cwd and call buildPreview without cwd. |
| e2e/cases/server/html-fallback/index.test.ts | Replace join(cwd, ...) entries with './src/index.js' across tests. |
| e2e/cases/server/history-api-fallback/historyApiFallback.test.ts | Remove cwd/join usage and use './src/index.jsx'; stop passing cwd to buildPreview. |
| e2e/cases/print-file-size/with-error/index.test.ts | Remove cwd and build without it. |
| e2e/cases/print-file-size/basic/index.test.ts | Remove cwd and build without it; keep helper using toPosixPath. |
| e2e/cases/plugin-react/disable-fast-refresh/index.test.ts | Destructure cwd from test context for fs operations; remove local cwd. |
| e2e/cases/output/clean-dist-path/index.test.ts | Build without passing cwd; retain existing cwd for path setup. |
| e2e/cases/hmr/reconnect/index.test.ts | Destructure cwd from test context and remove local cwd. |
| e2e/cases/hmr/rebuild-logs/index.test.ts | Destructure cwd in both tests; remove local cwd. |
| e2e/cases/hmr/multiple-connection/index.test.ts | Destructure cwd and remove local cwd. |
| e2e/cases/hmr/error-recovery/index.test.ts | Destructure cwd and remove local cwd. |
| e2e/cases/hmr/client-port-placeholder/index.test.ts | Destructure cwd and remove local cwd. |
| e2e/cases/hmr/client-host/index.test.ts | Destructure cwd and remove local cwd. |
| e2e/cases/hmr/basic/index.test.ts | Convert to rspackTest(...) form and destructure cwd; remove local cwd. |
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.
💡 Codex Review
rsbuild/e2e/cases/server/html-fallback/index.test.ts
Lines 1 to 4 in 9808dca
After switching the test to use relative entry paths, the join import and const cwd = __dirname declaration at the top of this file are no longer referenced anywhere. The repository’s lint rules (per AGENTS instructions) treat unused imports/variables as errors, so pnpm lint and CI will now fail. Consider removing these declarations to keep the test lint‑clean.
ℹ️ 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
- 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

Summary
cwdprovided by test contextjoinChecklist