Skip to content

Running tests with a fresh bootstrapped app yields error #14070

@madflow

Description

@madflow

Describe the bug

When runnning test in a newly bootstrapped app, I get:

 Error when evaluating SSR module /node_modules/@sveltejs/kit/src/runtime/server/index.js: Cannot read properties of undefined (reading 'wrapDynamicImport')

The tests still run and pass.

Reproduction

npx sv create broken
[y] Svelte library (setup with svelte-package to help correctly package your library)
[y] Yes, using TypeScript syntax
What would you like to add to your project? (use arrow keys / space bar)
│  ◼ prettier (formatter - https://prettier.io)
│  ◼ eslint (linter - https://eslint.org)
│  ◼ vitest (unit testing - https://vitest.dev)
│  ◼ playwright (browser testing - https://playwright.dev)
vitest: What do you want to use vitest for?
│  ◼ unit testing
│  ◼ component testing
Which package manager do you want to install dependencies with?
│  ○ None
│  ● npm

cd broken && npm i

npm run test:unit

[email protected] test:unit
vitest

DEV v3.2.4 /private/tmp/broken

The following Vite config options will be overridden by SvelteKit:

  • base
    ✓ server src/demo.spec.ts (1 test) 1ms
    12:14:50 PM [vite] (ssr) Error when evaluating SSR module /node_modules/@sveltejs/kit/src/runtime/server/index.js: Cannot read properties of undefined (reading 'wrapDynamicImport')
    at /private/tmp/broken/node_modules/@sveltejs/kit/src/runtime/app/server/event.js:9:1
    at ESModulesEvaluator.runInlinedModule (file:///private/tmp/broken/node_modules/vite/dist/node/module-runner.js:909:9)
    at SSRCompatModuleRunner.directRequest (file:///private/tmp/broken/node_modules/vite/dist/node/module-runner.js:1067:80)
    at SSRCompatModuleRunner.directRequest (file:///private/tmp/broken/node_modules/vite/dist/node/chunks/dep-BHkUv4Z8.js:18888:34)
    at SSRCompatModuleRunner.cachedRequest (file:///private/tmp/broken/node_modules/vite/dist/node/module-runner.js:973:23)
    at request (file:///private/tmp/broken/node_modules/vite/dist/node/module-runner.js:1014:76)
    at async eval (/private/tmp/broken/node_modules/@sveltejs/kit/src/runtime/server/endpoint.js:4:1)
    at async ESModulesEvaluator.runInlinedModule (file:///private/tmp/broken/node_modules/vite/dist/node/module-runner.js:909:3)
    at async SSRCompatModuleRunner.directRequest (file:///private/tmp/broken/node_modules/vite/dist/node/module-runner.js:1067:59)
    at async SSRCompatModuleRunner.directRequest (file:///private/tmp/broken/node_modules/vite/dist/node/chunks/dep-BHkUv4Z8.js:18888:22)
    ✓ client (chromium) src/routes/page.svelte.test.ts (1 test) 3ms

Test Files 2 passed (2)
Tests 2 passed (2)
Start at 12:14:49
Duration 1.39s (transform 19ms, setup 8ms, collect 95ms, tests 4ms, environment 0ms, prepare 1.58s)


### Logs

```Shell

System Info

node -v v22.14.0
npm --version 11.3.0

system_profiler SPSoftwareDataType SPHardwareDataType
Software:
    System Software Overview:

      System Version: macOS 15.5 (24F74)
      Kernel Version: Darwin 24.5.0

Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: Mac16,1
      Model Number: MW2U3D/A
      Chip: Apple M4
      Total Number of Cores: 10 (4 performance and 6 efficiency)
      Memory: 16 GB
      System Firmware Version: 11881.121.1
      OS Loader Version: 11881.121.1

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions