vitest-dev / vitest-dev/vitest

Regression: v2.1.0 makes folder globbing impossible in `vitest.workspace.ts` (No loader is configured for ".gitignore" files: .gitignore)

Open
#6,553 25 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation p3-minor-bug upstream
Dominant language
TypeScript
Stars
17.1k
Forks
2k
Avg merge
1d 22h
Merged PRs (30d)
94

Description

Describe the bug
I am aware that v2.1.0 made backwards incompatible changes, and that this was intentional.

It appears to be impossible (since v2.1.0) to glob for folders instead of files in vitest.workspace.ts.

The documentation states that this is valid configuration:

export default [
  'packages/*'
]

This appears to be incorrect, as it will now match any files in packages/ as a config file (i.e. packages/.gitignore, etc.)

I believe that this should be updated to read:

export default [
  'packages/*/'
]

Unfortunately this also does not work; it is additionally matching other files within the sub-folder as configuration files. (i.e.packages/package-1/.gitignore)

Reproduction
Previously (before v2.1.0), my vitest.workspace.ts contained:
export default ["./*"];

So all direct sub-folders (one level down) were considered packages in the workspace.

Today (when upgrading to ^2.1.0)

This works:

export default ["*/*vitest*"];

But the following all break (with some variant of No loader is configured for ".gitignore" files: .gitignore):

  • original, broken as expected by v2.1.0
    export default ["./*"];
    
  • Same but ending with /. I think we should expect this to only match folders, not files in those folders?
    export default ["./*/"];
    
  • Excluding ./ but ending with /. I think we should expect this to only match folders, not files in those folders?
    export default ["*/"];
    
System Info
`vitest ^2.1.0`

Tested with vitest `2.1.1`.
Used Package Manager

pnpm

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the folder patterns in vitest.workspace.ts with Vitest 2.1.1, comparing './', './/', '/', and '/vitest'. Trace how workspace globs are expanded and verify that folder patterns do not select files such as .gitignore; done when the documented folder configuration works without loader errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.