Search code examples
gulpglobgulp-glob

Ignoring test files in same dirs as source files in gulp globs


I have folders with test and source files mixed together

├── module-x
│   ├── module-x.hbs
│   ├── module-x.js
│   ├── module-x.less
│   └── module-x.test.js
├── module-y
│   ├── module-y.hbs
│   ├── module-y.js
│   ├── module-y.less
│   └── module-y.test.js

I have gulp running browserSync with some globs to watch files and reload the app. I can't find a glob that will watch the .js files but ignore the .test.js ones


Solution

  • This ones worked for me

    glob: path.resolve(root + "/**/!(*.test).js"),