Negation of patterns including parent directories (../) seems not to work.
See original GitHub issueGiven: File structure:
/
├┬ src/
|├ File.js
|├ File.spec.js
│└ FileSpec.js
└┬ build/
└ gulpfile.js
Glob array:
[
'../src/**/*.js',
'!../**/*{s,S}pec.js',
]
What were you expecting to happen?
The !
negation pattern would exclude the spec files from the stream. Given the gulpfile below, I expect to see something like this when I run gulp
:
...
[00:00:00] gulp-debug: ../src/deep/File.js
[00:00:00] gulp-debug: 1 item
...
What actually happened?
The negation pattern doesn’t seem to apply correctly. Given the gulpfile below, I actually see something like this when I run gulp
:
...
[00:00:00] gulp-debug: ../src/deep/File.js
[00:00:00] gulp-debug: ../src/deep/File.spec.js
[00:00:00] gulp-debug: ../src/deep/FileSpec.js
[00:00:00] gulp-debug: 3 items
...
Please post a sample of your gulpfile (preferably reduced to just the bit that’s not working)
gulpfile.js
const gulp = require('gulp')
const debug = require('gulp-debug')
const FILES = [
'../src/**/*.js',
'!../**/*{s,S}pec.js',
// or even any of these
'!../**/*spec.js',
'!../**/*Spec.js',
'!../src/**/*{s,S}pec.js',
'!../src/*{s,S}pec.js',
// or even the file path specifically
'!../src/File.spec.js',
'!../src/FileSpec.js',
]
gulp.task('default', function () {
return gulp.src(FILES).pipe(debug())
})
What version of gulp are you using?
Gulp 4. (Notably, Gulp 3 works as expected.)
What versions of npm and node are you using?
- node v11.1.0
- npm 6.4.1
This is a .zip file of the reduced test case as described above. FWIW, the zip also includes a build-with-gulp-v3/ directory that allows comparing to gulp v3.9.1 behavior.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
Awesome. Hope it works. I’ll keep this open so we have a reference to the issue in this repo. Thanks for opening it.
Whoops! Missed that one for the comment before it! 😳 So sorry.
cwd
will probably do me just fine, I think. Thanks again!