Skip to content

fix: replace micromatch with picomatch #7951

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

Merged
merged 4 commits into from
May 9, 2025

Conversation

sapphi-red
Copy link
Contributor

@sapphi-red sapphi-red commented May 9, 2025

Description

This PR replaces all micromatch usage with picomatch.

Vitest uses tinyglobby in some places and tinyglobby uses picomatch (SuperchupuDev/tinyglobby#64 (comment)), so the behavior will be more consistent (micromatch supports slightly more syntaxes). Vite uses picomatch and does not use micromatch.
This PR should also reduce the package size a bit.

Explanation for each commit:

  • 2e5c108: replaced all micromatch.isMatch with picomatch.isMatch. this does not change the behavior because the implementation is same (micromatch sourcecode, picomatch sourcecode)
  • fa89bdf: replaced mm(related, forceRerunTriggers).length with related.some(file => pm(forceRerunTriggers)(file)). the previous implementation behaves differently from
    if (mm.isMatch(filepath, this.vitest.config.forceRerunTriggers)) {
  • 018a841: removed micromatch because all usage was replaced with picomatch
  • 8349743: extracted pm(glob) call outside the loop so that the glob compilation is done only once. I guess this can be done for other places, but I didn't include that in this PR as it won't be simple as this commit. It is probably worth trying for places that are called many times.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • [-] Ideally, include a test that fails without this PR but passes with it.
  • [-] Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • [-] If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

Copy link

netlify bot commented May 9, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 8349743
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/681d9efc8e2bed0008c5aa36
😎 Deploy Preview https://deploy-preview-7951--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sapphi-red sapphi-red marked this pull request as ready for review May 9, 2025 06:33
@sheremet-va sheremet-va merged commit df07611 into vitest-dev:main May 9, 2025
12 of 13 checks passed
@sheremet-va
Copy link
Member

Thank you!

@sapphi-red sapphi-red deleted the refactor/use-picomatch branch May 13, 2025 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants