Tests: Disable Vite depsOptimizer discovery in createTestApp#173
Merged
Conversation
- pluginContainer.close awaits in-flight scan transforms forever (vite 8) - discover.cancel() at teardown doesn't propagate to dispatched calls - programmatic-only workers hit the 60s workerUrl fixture timeout - noDiscovery: true matches vitest's workaround (commit e379f64)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Written by Claude.
Fixes a
Fixture "workerUrl" timeout of 60000ms exceeded during teardownflake hit on programmatic-only Playwright workers (e.g.assets/programmatic/*.ts).Root cause
Vite's
pluginContainer.close()(vite/dist/node/chunks/node.js:30192) does:_processesingcontains in-flightresolveId/load/transformcalls dispatched by the depsOptimizer's startup scan. Whendiscover.cancel()runs at teardown, the cancel does not propagate to those calls — they stay unsettled andPromise.allSettledwaits forever.Workers that never visit
/admin/(programmatic-only suites) finish their tests fast and tear down while the scan is still in flight, triggering the hang.Fix
optimizeDeps: { noDiscovery: true, include: [] }— skip the discovery scan entirely. No scan = nothing in flight at teardown = no hang.Same workaround vitest applies for the same reason: vitest commit e379f64 "fix: disable optimizeDeps when running tests". Closest open vite issue is vite#18224 (
p2-edge-case, still open). The maintainers have acknowledged depsOptimizer cleanup is a hole inserver.close().include: []is a no-op merge against the AdminController's existing include list (assignDeeply on arrays is positional), so explicit pre-bundles still apply.Verified
10 cold-cache local runs (cleared
dito-e2e-vite-cachebefore each), all clean — noFailed workerand 0Re-optimizing dependenciesmessages.Test plan
pnpm --filter @ditojs/tests test:e2ecold and confirm no teardown timeout