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

v.1.5.0 can't pass filters with leading/trailing slashes to CLI #5534

Closed
6 tasks done
diegohaz opened this issue Apr 13, 2024 · 2 comments · Fixed by #5578
Closed
6 tasks done

v.1.5.0 can't pass filters with leading/trailing slashes to CLI #5534

diegohaz opened this issue Apr 13, 2024 · 2 comments · Fixed by #5578
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@diegohaz
Copy link

Describe the bug

Before v1.5.0, I could pass filters with leading/trailing slashes like so:

vitest /basic

This would ensure tests with files beginning with basic run, but something-basic wouldn't.

Now, this filter doesn't work anymore.

Reproduction

Open https://stackblitz.com/edit/vitest-dev-vitest-ggq36j?file=package.json and check the logs.

It will first run vitest run /basic with v1.5.0, where the filter doesn't work. Then, it will install v1.4.0 and run the same command. Now the filter works.

System Info

StackBlitz stats:

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.3 - /usr/local/bin/pnpm
  npmPackages:
    @vitest/ui: latest => 1.5.0 
    vite: latest => 5.2.8

Used Package Manager

npm

Validations

@hi-ogawa
Copy link
Contributor

hi-ogawa commented Apr 21, 2024

It looks like the handling of leading slash has changed and probably supporting your example makes sense, so I made a PR for the fix.

You also mentioned trailing slash, but I'm not sure about that part. Can you elaborate what's the issue with trailing slash?

@hi-ogawa hi-ogawa added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Apr 21, 2024
@diegohaz
Copy link
Author

@hi-ogawa Thank you for looking into this.

Trailing slash would follow the same logic: basic/ matches a folder basic and something-basic, but not basic-something.

@github-actions github-actions bot locked and limited conversation to collaborators May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants