Skip to content

Sveltekit plugin breaks vitest workspaces #11356

@josias-r

Description

@josias-r

Describe the bug

The vite @sveltejs/kit/vite sveltekit plugin is not compatible with vite workspace

Reproduction

  • npm i
  • npm test

https://github.com/josias-r/svelte-vitest-workspaces

Logs

npm test

> svelte-vitest-workspaces@1.0.0 test
> vitest

The following Vite config options will be overridden by SvelteKit:
  - root
src/app.html does not exist

 DEV  v0.32.4 /Users/myuser/git/svelte-vitest-workspaces

include: **/__tests__/**/*.?(c|m)[jt]s?(x), **/?(*.){test,spec}.?(c|m)[jt]s?(x)
exclude:  **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*
watch exclude:  **/node_modules/**, **/dist/**

No test files found, exiting with code 1

System Info

System:
    OS: macOS 14.1.1
    CPU: (12) arm64 Apple M2 Pro
    Memory: 95.47 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
    bun: 1.0.9 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 120.0.6099.109
    Safari: 17.1

Severity

annoyance

Additional Information

As it seems, the plugin breaks when it comes to the relative paths.
The include: ['src/**/*.{test,spec}.{js,ts}'] line should include all the unit tests, but for somereason it only detects them when it is set to include: ['my-app/src/**/*.{test,spec}.{js,ts}']

But that is also not a working workaround, as it causes other issues. Also not the warning src/app.html does not exist, which indicates that vitest is trying to run the tests not from the my-app folder, but (probably) the root folder

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions