Some checks failed
Hover-prefetch has two surfaces in SvelteKit: - data-sveltekit-preload-data (route loader data) - data-sveltekit-preload-code (route JS chunks) The original fix turned off only the loader-data side. Route-code chunks prefetched on hover can also include manually-mocked module URLs; an in-flight code prefetch landing after iframe teardown hits the same Playwright route handler that resolves manual mocks, raising the unhandled rejection. Disable both surfaces. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
21 lines
977 B
TypeScript
21 lines
977 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
|
|
// Browser-mode tests must run with SvelteKit's hover-prefetch disabled.
|
|
// Hover-prefetch fires real `fetch` requests for the target route's loader
|
|
// chunks; those go through the same Playwright route handler that serves
|
|
// mocked modules. Even after `cleanup()` tears down the iframe, an in-flight
|
|
// prefetch can still hit the handler — and if the worker's birpc channel has
|
|
// closed by then, the handler raises an unhandled rejection. ADR-012 / #553.
|
|
//
|
|
// This test enforces that the test-setup file ran and switched preload-data
|
|
// off on `document.body` before any spec started rendering.
|
|
describe('browser test setup', () => {
|
|
it('disables SvelteKit loader-data prefetch on document.body', () => {
|
|
expect(document.body.dataset.sveltekitPreloadData).toBe('off');
|
|
});
|
|
|
|
it('disables SvelteKit route-code prefetch on document.body', () => {
|
|
expect(document.body.dataset.sveltekitPreloadCode).toBe('off');
|
|
});
|
|
});
|