Describe the bug
When I attempt to update @sveltejs/kit, my CI fails, with the following error:
ReferenceError: __SVELTEKIT_APP_VERSION__ is not defined
This specifically occurs when I import { browser } from '$app/environment'; inside of a globalSetup test file. It appears that accessing $app/environment in any way during global setup causes this error.
Version 2.62.0 does not encounter this issue, but versions 2.63 and above all cause it.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-fann5ee8?file=tests%2FglobalSetup.ts
Logs
$ npm t
> minifolio@1.4.0 test
> vitest run
RUN v4.1.9 /home/maddy/Source/sveltekit-vitest-repro
No test files found, exiting with code 1
include: **/*.{test,spec}.?(c|m)[jt]s?(x)
exclude: **/node_modules/**, **/.git/**
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
ReferenceError: __SVELTEKIT_APP_VERSION__ is not defined
❯ node_modules/@sveltejs/kit/src/runtime/app/env/internal.js?v=7391b49e:1:24
❯ VitestModuleEvaluator._runInlinedModule node_modules/vitest/dist/module-evaluator.js:206:120
❯ node_modules/vitest/dist/module-evaluator.js:107:62
❯ Traces.$ node_modules/vitest/dist/chunks/traces.DT5aQ62U.js:142:27
❯ VitestModuleEvaluator.runInlinedModule node_modules/vitest/dist/module-evaluator.js:107:21
❯ ServerModuleRunner.directRequest node_modules/vite/dist/node/module-runner.js:1259:80
❯ ServerModuleRunner.cachedRequest node_modules/vite/dist/node/module-runner.js:1166:73
System Info
System:
OS: Linux 7.1 cpe:/o:nixos:nixos:26.05 26.05 (Yarara)
CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
Memory: 46.77 GB / 62.43 GB
Container: Yes
Shell: 5.9.1 - /run/current-system/sw/bin/zsh
Binaries:
Node: 24.18.0 - /home/maddy/.local/share/mise/installs/node/24/bin/node
npm: 11.16.0 - /home/maddy/.local/share/mise/installs/node/24/bin/npm
pnpm: 11.9.0 - /home/maddy/.local/share/mise/installs/github-pnpm-pnpm/latest/pnpm
bun: 1.3.14 - /home/maddy/.local/share/mise/installs/bun/latest/bin/bun
Deno: 2.9.0 - /home/maddy/.local/share/mise/installs/deno/2.9.0/bin/deno
Browsers:
Chromium: 149.0.7827.200
Firefox: 152.0.3
Firefox Developer Edition: 152.0.3
npmPackages:
@sveltejs/adapter-node: ^5.5.7 => 5.5.7
@sveltejs/kit: ^2.63.0 => 2.63.0
@sveltejs/vite-plugin-svelte: ^7.1.2 => 7.1.2
svelte: ^5.56.4 => 5.56.4
vite: ^8.1.0 => 8.1.0
Severity
blocking an upgrade
Additional Information
No response
Describe the bug
When I attempt to update
@sveltejs/kit, my CI fails, with the following error:This specifically occurs when I
import { browser } from '$app/environment';inside of aglobalSetuptest file. It appears that accessing$app/environmentin any way during global setup causes this error.Version 2.62.0 does not encounter this issue, but versions 2.63 and above all cause it.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-fann5ee8?file=tests%2FglobalSetup.ts
npm cinpm tLogs
System Info
System: OS: Linux 7.1 cpe:/o:nixos:nixos:26.05 26.05 (Yarara) CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz Memory: 46.77 GB / 62.43 GB Container: Yes Shell: 5.9.1 - /run/current-system/sw/bin/zsh Binaries: Node: 24.18.0 - /home/maddy/.local/share/mise/installs/node/24/bin/node npm: 11.16.0 - /home/maddy/.local/share/mise/installs/node/24/bin/npm pnpm: 11.9.0 - /home/maddy/.local/share/mise/installs/github-pnpm-pnpm/latest/pnpm bun: 1.3.14 - /home/maddy/.local/share/mise/installs/bun/latest/bin/bun Deno: 2.9.0 - /home/maddy/.local/share/mise/installs/deno/2.9.0/bin/deno Browsers: Chromium: 149.0.7827.200 Firefox: 152.0.3 Firefox Developer Edition: 152.0.3 npmPackages: @sveltejs/adapter-node: ^5.5.7 => 5.5.7 @sveltejs/kit: ^2.63.0 => 2.63.0 @sveltejs/vite-plugin-svelte: ^7.1.2 => 7.1.2 svelte: ^5.56.4 => 5.56.4 vite: ^8.1.0 => 8.1.0Severity
blocking an upgrade
Additional Information
No response