test(web): un-skip discover/requests route tests — mock $app (#374)
Root cause: discover.test.ts and requests.test.ts were the only route
page tests NOT mocking $app/state (+ $app/navigation), so rendering
the +page.svelte pulled in SvelteKit's client runtime and threw
`TypeError: notifiable_store is not a function` at module load. They'd
been describe.skip'd AND hard-excluded in vitest.config.ts.
Fix mirrors every other route test: vi.hoisted pageState +
vi.mock('$app/state', () => pageUrlModule(state)) +
vi.mock('$app/navigation', () => ({ goto: vi.fn() })). Un-skip both
describe blocks; drop the vitest.config exclude. The web test job
now runs both suites again.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-13
@@ -7,19 +7,7 @@ export default defineConfig({
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
include: ['src/**/*.test.ts', 'src/**/*.svelte.test.ts', 'scripts/**/*.test.js'],
|
||||
// M7 #374: these two test files explode at module-load with
|
||||
// `TypeError: notifiable_store is not a function` from SvelteKit's
|
||||
// internal client.js — the import chain triggers SvelteKit's client
|
||||
// runtime init in a way the dev-push vitest invocation can't satisfy.
|
||||
// describe.skip inside the files doesn't help because vitest must
|
||||
// load the file before it can see the describe block. Excluded here
|
||||
// until the triage in #374 lands a real fix (probably a $app/paths
|
||||
// mock in vitest.setup.ts).
|
||||
exclude: [
|
||||
...configDefaults.exclude,
|
||||
'src/routes/discover/discover.test.ts',
|
||||
'src/routes/requests/requests.test.ts'
|
||||
],
|
||||
exclude: [...configDefaults.exclude],
|
||||
setupFiles: ['./vitest.setup.ts']
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user