Skip to content

test: run playgrounds under bundled dev, skip unsupported cases - #23027

Merged
sapphi-red merged 6 commits into
mainfrom
test/bundled-dev-playgrounds
Jul 24, 2026
Merged

sapphi-red merged 6 commits into
mainfrom
test/bundled-dev-playgrounds

Conversation

@h-a-n-a

@h-a-n-a h-a-n-a commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

Description

Skipped tests are tracked in #23028.

This PR makes the whole playground e2e suite runnable under full bundle mode, with one command and no per-playground configs:

  • New script pnpm run test-serve-bundled (env VITE_TEST_BUNDLED_DEV=1). playground/vitestSetup.ts merges experimental: { bundledDev: true } on top of each playground's own config after loading it, so the mode is forced everywhere.
  • New isBundledDev flag exported from ~utils. Every test that does not pass under bundled dev yet is marked test.skipIf(isBundledDev) (or describe.skipIf(isBundledDev) for loop-generated groups). These tests still run in normal serve and build modes, where isBundledDev is always false.
  • Result: the bundled-dev suite is green — 580 passed / 704 skipped / 0 failed, about 17s. Normal serve and build runs are unchanged.

The skips are a tracked to-do list, not accepted behavior: 502 tests are skipped because they fail under bundled dev today (497 from the baseline run on main @ 34af7b7, plus 5 found once timing was made deterministic, see below). About 30 more currently-passing tests are also skipped because they live in shared helper files (fs-serve/__tests__/commonTests.ts, css/__tests__/tests.ts) where a per-importing-spec condition is not possible with plain vitest APIs.

Why most tests fail under bundled dev

The dev server in bundled mode serves the outputs of a rolldown bundle from memory. It does not serve individual source files by URL.

flowchart LR
    R["browser request"] --> N{"normal dev"}
    R --> F{"bundled dev"}
    N -->|"/nested/asset.png"| N1["file read and transform → 200 with source-path URL"]
    N -->|"/@fs/ path outside allow"| N2["403 Restricted"]
    F -->|"/assets/asset-HASH.png"| F1["bundle output from memory → 200"]
    F -->|"any other file URL"| F2["no handler → 404 or HTML fallback"]
Loading

Minimal example — same import, different URL shape:

import imgUrl from './nested/asset.png'
// normal dev:  '/nested/asset.png'
// bundled dev: '/assets/asset-C1hss4aq.png'

Main failure classes: asset/source URL shape (assets 122, and parts of html/css), only-bundle-outputs-served (fs-serve 108 — verified fail-closed, denied files are never leaked, but allowed static//@fs/ fetches 404), HMR gaps (hmr 42), workers (50), dep optimizer interplay (optimize-deps 52), sourcemaps (25), plus many small groups that follow from the first two classes.

Harness fix: wait out the fallback page

Bundled dev serves a self-reloading fallback page until the first bundle completes. Without handling this, results are timing-dependent: a test that runs early asserts against the placeholder page and fails at random. vitestSetup.ts now waits for the real page after page.goto:

  • bounded at 15s, so playgrounds whose first bundle intentionally fails (tsconfig-json-load-error, optimize-deps) still run and handle that state themselves,
  • hmr-full-bundle-mode is exempt because its first test asserts the fallback page itself.

How to work on a skipped test

  1. Remove the skipIf(isBundledDev).
  2. Run pnpm run test-serve-bundled <playground-name>.
  3. Fix the behavior, or update the assertion if the bundled-dev behavior is the intended one, and delete the skip.

🤖 Generated with Claude Code

h-a-n-a added 3 commits July 23, 2026 21:12
Add VITE_TEST_BUNDLED_DEV=1 (pnpm run test-serve-bundled) to force
experimental.bundledDev for every playground without separate configs.
Tests that do not pass under bundled dev yet are marked with
test.skipIf(isBundledDev) / describe.skipIf(isBundledDev) and still run
in normal serve and build modes.

vitestSetup now waits for the bundled-dev fallback page to swap to the
real page after page.goto (bounded at 15s; hmr-full-bundle-mode is
exempt because it asserts the fallback itself), which makes bundled-dev
results deterministic.
@h-a-n-a
h-a-n-a marked this pull request as ready for review July 23, 2026 13:41
@h-a-n-a
h-a-n-a requested a review from sapphi-red July 23, 2026 13:41
@sapphi-red

Copy link
Copy Markdown
Member

instead of adding skipIf everywhere, can we explicitly list the files in

include: ['./playground/**/*.spec.[tj]s'],
and then add more and more files to that list? (we should still keep isBundledDev so we can enable playgrounds with few failing tests)
When the list is long enough, we can switch to listing the excluded files.

Per review: instead of skipIf everywhere, vitest.config.e2e.ts now lists
every spec file for the bundled-dev run, with not-yet-passing files
commented out. Files with only a few failing cases stay enabled and keep
test.skipIf(isBundledDev) for those cases. Heavily-failing files got
their skipIf annotations reverted.
@h-a-n-a

h-a-n-a commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

Reworked as suggested in 4d658ad: vitest.config.e2e.ts now has an explicit bundledDevInclude list for the bundled-dev run. Every spec file is listed; the 20 files that do not pass yet are commented out, and their skipIf annotations are reverted. Files with only a few failing cases (28 files, ≤5 cases each) stay enabled and keep test.skipIf(isBundledDev) for those cases.

One tradeoff to be aware of: the commented-out files also contained ~240 tests that pass under bundled dev (e.g. large parts of hmr and assets), and those no longer run in the bundled-dev job. If we want that coverage back for a specific playground before it is fully fixed, we can re-enable its file and switch it to per-case skipIf.

Suite is green in this mode (341 passed / 159 skipped / 0 failed, ~20s), and the normal serve/build runs are unchanged. Tracking issue #23028 is updated to describe the uncomment-the-file workflow.

@sapphi-red

sapphi-red commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

Would you remove the playgrounds that most test fails from include? For example, playground/tailwind/__test__/tailwind.spec.ts.

Also, given that there's more include that exclude, I think we can use exclude from the start.

Per review: use exclude from the start, and move files where most cases
fail under bundled dev (e.g. tailwind, 4 of 5) into bundledDevExclude
instead of keeping per-case skipIf. skipIf remains only in files where
failing cases are the minority.
@h-a-n-a

h-a-n-a commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

Both done in d105a5c:

  • Switched to bundledDevExclude — the normal include glob stays, and the 35 not-yet-passing files are listed in the exclude array. Removing a line enables the file.
  • Files where most cases fail moved into the exclude list (15 more, including tailwind at 4 of 5) and their skipIf annotations are reverted. skipIf now only remains in 13 files where the failing cases are a clear minority (e.g. resolve 4 of 54, dynamic-import 4 of 25).

Bundled-dev suite: 73 files collected, 0 failures. Normal serve and build runs unchanged.

@sapphi-red sapphi-red left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍

@sapphi-red
sapphi-red merged commit 2ad9ec2 into main Jul 24, 2026
21 checks passed
@sapphi-red
sapphi-red deleted the test/bundled-dev-playgrounds branch July 24, 2026 06:43
h-a-n-a added a commit to rolldown/rolldown that referenced this pull request Jul 24, 2026
Vite merged vitejs/vite#23027, which added a `test-serve-bundled` script: it runs the whole playground e2e suite under bundled dev mode (`VITE_TEST_BUNDLED_DEV=1`), with unsupported cases skipped.

This PR makes `packages/vite-tests/run.ts` run that suite as well, between `test-serve` and `test-build`. The prepared vite checkout is always the latest `rolldown-canary` rebased onto `main`, and that always contains the script since the rebase on 2026-07-24.

Verified locally at the current `rolldown-canary` tip (50fd47de7) with a locally built rolldown linked in: 330 passed, 116 skipped, 0 failed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
graphite-app Bot pushed a commit to rolldown/rolldown that referenced this pull request Jul 24, 2026
#10434)

Vite merged vitejs/vite#23027, which added a `test-serve-bundled` script: it runs the whole playground e2e suite under bundled dev mode (`VITE_TEST_BUNDLED_DEV=1`), with unsupported cases skipped.

This PR makes `packages/vite-tests/run.ts` run that suite as well, between `test-serve` and `test-build`. The prepared vite checkout is always the latest `rolldown-canary` rebased onto `main`, and that always contains the script since the rebase on 2026-07-24.

Verified locally at the current `rolldown-canary` tip (50fd47de7) with a locally built rolldown linked in: 330 passed, 116 skipped, 0 failed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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