Write E2E cases
Rsdoctor E2E tests use Playwright and live under e2e/cases/. Each bundler has its own directory:
e2e/cases/doctor-rspack/— tests using Rspack compilatione2e/cases/doctor-rsbuild/— tests using Rsbuilde2e/cases/doctor-rspeedy/— tests using Rspeedy
Steps
Review uncommitted git changes to define test scope and target behavior.
Read
e2e/README.mdand follow its conventions.Use helpers from
@scripts/test-helper(for examplecompileByRspack) to compile fixtures. Do not call bundler APIs directly.Add Playwright test files under the appropriate
e2e/cases/doctor-*directory, following existing patterns.Test fixtures (source files, loaders, configs) go in
fixtures/subdirectories inside each case directory.Keep assertions focused and readable; avoid redundant setup and checks.
Run
pnpm e2efrom the repository root to validate.
Case structure
- Each test file creates an Rsdoctor plugin instance (e.g.,
createRsdoctorPluginfrom a localtest-utils.ts), compiles a fixture viacompileByRspack, and asserts on the SDK store data. - Fixtures are plain JS/TS files and loaders in
fixtures/— not full application directories. - Use
@rsdoctor/core/pluginsforgetSDK/setSDKwhen inspecting analysis results.
Constraints
- If tests can pass only after source-code changes, do not change source code directly. Explain the required source change and ask the user before proceeding.