-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Describe the bug
I did an upgrade of @sveltejs/kit to version 2.27.2 and now the import statement of my vitest crashes.
This statement -> import * as models from '$app/navigation';
leads to this when running vitest:
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL src/import.test.ts [ src/import.test.ts ]
TypeError: Cannot read properties of undefined (reading 'data')
❯ node_modules/@sveltejs/kit/src/runtime/client/client.js:181:55
179|
180| /** @type {Record<string, any>} */
181| export const remote_responses = __SVELTEKIT_PAYLOAD__.data ?? {};
| ^
182|
183| /** @type {Array<((url: URL) => boolean)>} */
❯ node_modules/@sveltejs/kit/src/runtime/app/navigation.js:1:1
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Reproduction
I can reproduce it with a fresh project here.
import { test, vi } from 'vitest';
import * as models from '$app/navigation';
test('test', async () => {
vi.spyOn(models, 'goto').mockImplementation((): Promise<void> => {
return new Promise<void>((resolve) => {
resolve();
});
});
});
Logs
System Info
System:
OS: Linux 6.15 Arch Linux
CPU: (32) x64 AMD Ryzen 9 7950X3D 16-Core Processor
Memory: 44.49 GB / 62.01 GB
Container: Yes
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.18.0 - ~/.nvm/versions/node/v22.18.0/bin/node
npm: 10.9.3 - ~/.nvm/versions/node/v22.18.0/bin/npm
Browsers:
Chromium: 138.0.7204.168
npmPackages:
@sveltejs/adapter-auto: ^6.0.0 => 6.0.1
@sveltejs/kit: 2.27.2 => 2.27.2
@sveltejs/vite-plugin-svelte: ^6.0.0 => 6.1.0
svelte: ^5.0.0 => 5.38.0
vite: ^7.0.4 => 7.1.0
Severity
serious, but I can work around it
Additional Information
The workaround is to use version 2.27.1
I think this commit leads to the problem.
danieldiekmeier, pheuter, n4bb12, tygore587, LucasHillDex and 2 more
Metadata
Metadata
Assignees
Labels
No labels