-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Regression: v2.1.0 makes folder globbing impossible in vitest.workspace.ts
(No loader is configured for ".gitignore" files: .gitignore)
#6553
Comments
The glob you mentioned is correct since it only matches the first level assuming you only have folders there:
|
Hello @kahagerman. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with |
This is not actually the issue I am reporting, though it is related. Typically when globbing, a trailing This is not being respected (seems like every file under this path is matched), so there is no way to match only folders, and thus no way to restore the old behaviour. |
I'm having a similar problem but the issue is with
My vitest workspace is configured as: import { defineWorkspace } from 'vitest/config';
export default defineWorkspace([
'packages/*',
]); This configuration works in |
@treardon17 Note that there was a breaking change made for workspaces in v2.1.0, check the release notes. |
This is just not true. The glob that matches only folders works correctly with The glob
The |
This fails if a plain file exists in Here the only thing I changed was to add an empty |
And it fails correctly because the file matches your glob. If Vitest sees a file, it assumes that it’s a Vitest config. This is mentioned in the documentation. |
No, |
As I said before:
But there is no issue with a glob mentioned in the documentation when it is used correctly. |
Ok, I see what you're saying now; I misunderstood your original comment. I wonder if it's worth using a more mature glob library if tinyglobby doesn't support this today. |
My thoughts on this:
|
investigating the trailing you can test this inconsistency in import glob from 'fast-glob';
// dynamic pattern, only returns folders so no files are matched
await glob(['*.ts/'], {
onlyFiles: false
});
// static pattern, returns files too
await glob(['index.ts/'], {
onlyFiles: false
}); |
I think this is just a bug in |
yeah but i imagine making |
Would it make sense to upstream this issue to |
Can you give an example of a use case that it breaks? I didn't find any tools online that support having a Here is an example of this exact issue in Here is a
|
basically what i mentioned above, using a pattern like |
Can you explain why you think that is the case? I don't see why people would use it that way since other tools disagree ( |
Arguably,
|
The new built-in
|
how does |
Like you would expect:
And it is the correct behaviour. The bug is when it doesn't treat the |
just opened mrmlnc/fast-glob#458 |
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:
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:
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:
So all direct sub-folders (one level down) were considered packages in the workspace.
Today (when upgrading to
^2.1.0
)This works:
But the following all break (with some variant of
No loader is configured for ".gitignore" files: .gitignore
):/
. I think we should expect this to only match folders, not files in those folders?./
but ending with/
. I think we should expect this to only match folders, not files in those folders?System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: