gulpjs / gulpjs/glob-stream

File path after negative glob causes 'File not found with singular glob'

Open
#138 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
181
Forks
50
PR merge metrics
No merged PRs in 30d

Description

### What actually happened?
A ' File not found with singular glob' error will be thrown if a file path will be defined after a negative glob.

That's a regression to `6.1.0` and it seems that this issue is caused by the fact that `anymatch#matchPatterns` function just returns the index of the `patterns` array which does not include the negative patterns.

Therefore `ourGlobs[matchIdx]` returns the wrong glob.

- https://github.com/micromatch/anymatch/blob/cbd278e43710eaf325d2061fa11aefd127c509be/index.js#L63
- https://github.com/gulpjs/glob-stream/blob/77826594b4479fe5fefd6a751c28c7f686c24a87/index.js#L318C41-L319C1

### Please give us a sample of your gulpfile

I added two tests at my fork:
-https://github.com/curvedriver/glob-stream/pull/1/files

1. `file path before negative glob` works as expected
2. `file path after negative glob` throws the mentioned `Error: File not found with singular glob:`

See:
- https://github.com/curvedriver/glob-stream/actions/runs/9661353317/job/26648885876

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.