Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspace configuration works only with inline configuration #4577

Closed
6 tasks done
ascariandrea opened this issue Nov 23, 2023 · 7 comments
Closed
6 tasks done

Workspace configuration works only with inline configuration #4577

ascariandrea opened this issue Nov 23, 2023 · 7 comments
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) pr welcome

Comments

@ascariandrea
Copy link

Describe the bug

Hi there, I'm having an issue with workspace configuration in my project. Basically, it runs all the tests only when configurations are defined inline, while it runs only the first matched when defined with the glob pattern.

In the reproduction I've defined the vitest.workspace.ts with both configurations (the glob pattern one is commented) so you can check this properly.

Reproduction

https://stackblitz.com/edit/stackblitz-starters-qrhqud?file=vitest.workspace.ts

System Info

System:
    OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 4.10 GB / 15.34 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 16.20.0 - ~/.nvm/versions/node/v16.20.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.20.0/bin/yarn
    npm: 9.7.1 - ~/.nvm/versions/node/v16.20.0/bin/npm
    bun: 1.0.3 - ~/.bun/bin/bun
  Browsers:
    Chrome: 119.0.6045.159
  npmPackages:
    @vitest/coverage-v8: ^0.34.5 => 0.34.6 
    @vitest/ui: ^0.34.6 => 0.34.6 
    vitest: ^0.34.5 => 0.34.6

Used Package Manager

yarn

Validations

@sheremet-va
Copy link
Member

sheremet-va commented Nov 23, 2023

Vitest uses only a single config per folder at the moment, it filters others out.

@ascariandrea
Copy link
Author

Thanks for the quick reply @sheremet-va, did I miss this point in the documentation or is not highlighted at all?

@sheremet-va
Copy link
Member

It's not highlighted, and looks like a bug to be honest.

@sheremet-va sheremet-va added bug p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Nov 23, 2023
@Lewenhaupt
Copy link

Lewenhaupt commented Nov 30, 2023

Also encountered this when I tried to add a config file for unit tests and one for integration tests in the same folder. But simple enough to move to a subfolder for my integration tests as a workaround.

@sheremet-va
Copy link
Member

I think the initial idea was to filter out vite.config if there is a vitest.config in the same folder. Instead of the current solution, we should just remove vite.config if there is already a vitest.config in the folder.

@ascariandrea
Copy link
Author

@sheremet-va yes, the correct implementation I expect would filter out the vite(st).config keeping all the others matching the glob pattern.

@sheremet-va
Copy link
Member

The workspace resolution was rewritten in 2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) pr welcome
Projects
None yet
Development

No branches or pull requests

3 participants