Describe the bug
In our private CI system, all projects will be put into $HOME/.cache/projects when cloning repositories. However, Vitest's default exclude filter will ignore all the files whose paths contains .cache . This sounds OK when there're some directories called .cache in current working directory. But for us, $HOME/.cache isn't not a directory under current working directory.
When researching the logic of Vitest, I found that the absolute option of fast-glob was set to true, so all the test files (e.g. $HOME/.cache/projects/example.test.ts) will match that exclude filter, which causes Vitest exits with No test files found error.
Here is the absolute option:
I know we can change our Vitest config to let Vitest not ignore the paths contain .cache, but I'm still curious why the absolute option was enabled. In my opinion, both include and exclude options should only be considered under current working directory with relative path, not absolute path.
Reproduction
This issue can't be simulated with online sandbox or a reproduction repo, but this issue can be reproduced by moving a project to a directory called .cache. You can simply create a directory called .cache and move into it.
System Info
System: Linux
Vitest version: v0.33.0
Used Package Manager
pnpm
Validations
Describe the bug
In our private CI system, all projects will be put into
$HOME/.cache/projectswhen cloning repositories. However, Vitest's defaultexcludefilter will ignore all the files whose paths contains.cache. This sounds OK when there're some directories called.cachein current working directory. But for us,$HOME/.cacheisn't not a directory under current working directory.When researching the logic of Vitest, I found that the
absoluteoption offast-globwas set totrue, so all the test files (e.g.$HOME/.cache/projects/example.test.ts) will match thatexcludefilter, which causes Vitest exits withNo test files founderror.Here is the
absoluteoption:vitest/packages/vitest/src/node/workspace.ts
Line 140 in 8693449
I know we can change our Vitest config to let Vitest not ignore the paths contain
.cache, but I'm still curious why theabsoluteoption was enabled. In my opinion, bothincludeandexcludeoptions should only be considered under current working directory with relative path, not absolute path.Reproduction
This issue can't be simulated with online sandbox or a reproduction repo, but this issue can be reproduced by moving a project to a directory called
.cache. You can simply create a directory called.cacheand move into it.System Info
Used Package Manager
pnpm
Validations