pax_global_header00006660000000000000000000000064132042607430014513gustar00rootroot0000000000000052 comment=9bf9983bca42c2176657a2084608bd6fca417258 globby-7.1.1/000077500000000000000000000000001320426074300127775ustar00rootroot00000000000000globby-7.1.1/.editorconfig000066400000000000000000000002571320426074300154600ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.yml] indent_style = space indent_size = 2 globby-7.1.1/.gitattributes000066400000000000000000000000351320426074300156700ustar00rootroot00000000000000* text=auto *.js text eol=lf globby-7.1.1/.gitignore000066400000000000000000000000411320426074300147620ustar00rootroot00000000000000node_modules yarn.lock *.tmp tmp globby-7.1.1/.npmrc000066400000000000000000000000231320426074300141120ustar00rootroot00000000000000package-lock=false globby-7.1.1/.travis.yml000066400000000000000000000000631320426074300151070ustar00rootroot00000000000000language: node_js node_js: - '8' - '6' - '4' globby-7.1.1/bench.js000066400000000000000000000034511320426074300144170ustar00rootroot00000000000000'use strict'; /* global after, before, bench, suite */ const fs = require('fs'); const rimraf = require('rimraf'); const globbyMaster = require('globby'); const gs = require('glob-stream'); const fastGlob = require('fast-glob'); const globby = require('.'); const BENCH_DIR = 'bench'; const runners = [{ name: 'globby async (working directory)', run: (patterns, cb) => { globby(patterns).then(cb.bind(null, null), cb); } }, { name: 'globby async (upstream/master)', run: (patterns, cb) => { globbyMaster(patterns).then(cb.bind(null, null), cb); } }, { name: 'globby sync (working directory)', run: patterns => { globby.sync(patterns); } }, { name: 'globby sync (upstream/master)', run: patterns => { globbyMaster.sync(patterns); } }, { name: 'glob-stream', run: (patterns, cb) => { gs(patterns).on('data', () => {}).on('end', cb); } }, { name: 'fast-glob async', run: (patterns, cb) => { fastGlob(patterns).then(cb.bind(null, null), cb); } }, { name: 'fast-glob sync', run: patterns => { fastGlob.sync(patterns); } }]; const benchs = [{ name: 'negative globs (some files inside dir)', patterns: ['a/*', '!a/c*'] }, { name: 'negative globs (whole dir)', patterns: ['a/*', '!a/**'] }, { name: 'multiple positive globs', patterns: ['a/*', 'b/*'] }]; before(() => { process.chdir(__dirname); rimraf.sync(BENCH_DIR); fs.mkdirSync(BENCH_DIR); process.chdir(BENCH_DIR); ['a', 'b'] .map(dir => `${dir}/`) .forEach(dir => { fs.mkdirSync(dir); for (let i = 0; i < 500; i++) { fs.writeFileSync(dir + (i < 100 ? 'c' : 'd') + i, ''); } }); }); after(() => { process.chdir(__dirname); rimraf.sync(BENCH_DIR); }); benchs.forEach(benchmark => { suite(benchmark.name, () => { runners.forEach(runner => bench(runner.name, runner.run.bind(null, benchmark.patterns))); }); }); globby-7.1.1/fixtures/000077500000000000000000000000001320426074300146505ustar00rootroot00000000000000globby-7.1.1/fixtures/gitignore/000077500000000000000000000000001320426074300166375ustar00rootroot00000000000000globby-7.1.1/fixtures/gitignore/.gitignore000066400000000000000000000000171320426074300206250ustar00rootroot00000000000000foo.js !bar.js globby-7.1.1/fixtures/gitignore/bar.js000066400000000000000000000001341320426074300177370ustar00rootroot00000000000000import test from 'ava' import fn from '..' test(t => { t.is(fn('foo'), fn('foobar')) }) globby-7.1.1/fixtures/multiple-negation/000077500000000000000000000000001320426074300203055ustar00rootroot00000000000000globby-7.1.1/fixtures/multiple-negation/!!unicorn.js000066400000000000000000000000001320426074300224100ustar00rootroot00000000000000globby-7.1.1/fixtures/multiple-negation/!unicorn.js000066400000000000000000000000001320426074300223470ustar00rootroot00000000000000globby-7.1.1/fixtures/multiple-negation/.gitignore000066400000000000000000000000401320426074300222670ustar00rootroot00000000000000*.js !!unicorn.js !!!unicorn.js globby-7.1.1/fixtures/negative/000077500000000000000000000000001320426074300164525ustar00rootroot00000000000000globby-7.1.1/fixtures/negative/.gitignore000066400000000000000000000000151320426074300204360ustar00rootroot00000000000000*.js !foo.js globby-7.1.1/fixtures/negative/foo.js000066400000000000000000000000341320426074300175700ustar00rootroot00000000000000console.log('no semicolon') globby-7.1.1/gitignore.js000066400000000000000000000041211320426074300153220ustar00rootroot00000000000000'use strict'; const fs = require('fs'); const path = require('path'); const glob = require('glob'); const gitIgnore = require('ignore'); const pify = require('pify'); const slash = require('slash'); const globP = pify(glob); const readFileP = pify(fs.readFile); const mapGitIgnorePatternTo = base => ignore => { if (ignore.startsWith('!')) { return '!' + path.posix.join(base, ignore.substr(1)); } return path.posix.join(base, ignore); }; const parseGitIgnore = (content, opts) => { const base = slash(path.relative(opts.cwd, path.dirname(opts.fileName))); return content .split(/\r?\n/) .filter(Boolean) .filter(l => l.charAt(0) !== '#') .map(mapGitIgnorePatternTo(base)); }; const reduceIgnore = files => { return files.reduce((ignores, file) => { ignores.add(parseGitIgnore(file.content, { cwd: file.cwd, fileName: file.filePath })); return ignores; }, gitIgnore()); }; const getIsIgnoredPredecate = (ignores, cwd) => { return p => ignores.ignores(slash(path.relative(cwd, p))); }; const getFile = (file, cwd) => { const filePath = path.join(cwd, file); return readFileP(filePath, 'utf8') .then(content => ({ content, cwd, filePath })); }; const getFileSync = (file, cwd) => { const filePath = path.join(cwd, file); const content = fs.readFileSync(filePath, 'utf8'); return { content, cwd, filePath }; }; const normalizeOpts = opts => { opts = opts || {}; const ignore = opts.ignore || []; const cwd = opts.cwd || process.cwd(); return {ignore, cwd}; }; module.exports = o => { const opts = normalizeOpts(o); return globP('**/.gitignore', {ignore: opts.ignore, cwd: opts.cwd}) .then(paths => Promise.all(paths.map(file => getFile(file, opts.cwd)))) .then(files => reduceIgnore(files)) .then(ignores => getIsIgnoredPredecate(ignores, opts.cwd)); }; module.exports.sync = o => { const opts = normalizeOpts(o); const paths = glob.sync('**/.gitignore', {ignore: opts.ignore, cwd: opts.cwd}); const files = paths.map(file => getFileSync(file, opts.cwd)); const ignores = reduceIgnore(files); return getIsIgnoredPredecate(ignores, opts.cwd); }; globby-7.1.1/gitignore.test.js000066400000000000000000000050221320426074300163010ustar00rootroot00000000000000import path from 'path'; import test from 'ava'; import gitignore from './gitignore'; test('gitignore', async t => { const cwd = path.join(__dirname, 'fixtures/gitignore'); const isIgnored = await gitignore({cwd}); const actual = ['foo.js', 'bar.js'].filter(file => !isIgnored(file)); const expected = ['bar.js']; t.deepEqual(actual, expected); }); test('gitignore - sync', t => { const cwd = path.join(__dirname, 'fixtures/gitignore'); const isIgnored = gitignore.sync({cwd}); const actual = ['foo.js', 'bar.js'].filter(file => !isIgnored(file)); const expected = ['bar.js']; t.deepEqual(actual, expected); }); test('ignore ignored .gitignore', async t => { const cwd = path.join(__dirname, 'fixtures/gitignore'); const ignore = ['**/.gitignore']; const isIgnored = await gitignore({cwd, ignore}); const actual = ['foo.js', 'bar.js'].filter(file => !isIgnored(file)); const expected = ['foo.js', 'bar.js']; t.deepEqual(actual, expected); }); test('ignore ignored .gitignore - sync', t => { const cwd = path.join(__dirname, 'fixtures/gitignore'); const ignore = ['**/.gitignore']; const isIgnored = gitignore.sync({cwd, ignore}); const actual = ['foo.js', 'bar.js'].filter(file => !isIgnored(file)); const expected = ['foo.js', 'bar.js']; t.deepEqual(actual, expected); }); test('negative gitignore', async t => { const cwd = path.join(__dirname, 'fixtures/negative'); const isIgnored = await gitignore({cwd}); const actual = ['foo.js', 'bar.js'].filter(file => !isIgnored(file)); const expected = ['foo.js']; t.deepEqual(actual, expected); }); test('negative gitignore - sync', t => { const cwd = path.join(__dirname, 'fixtures/negative'); const isIgnored = gitignore.sync({cwd}); const actual = ['foo.js', 'bar.js'].filter(file => !isIgnored(file)); const expected = ['foo.js']; t.deepEqual(actual, expected); }); test('multiple negation', async t => { const cwd = path.join(__dirname, 'fixtures/multiple-negation'); const isIgnored = await gitignore({cwd}); const actual = [ '!!!unicorn.js', '!!unicorn.js', '!unicorn.js', 'unicorn.js' ].filter(file => !isIgnored(file)); const expected = ['!!unicorn.js', '!unicorn.js']; t.deepEqual(actual, expected); }); test('multiple negation - sync', t => { const cwd = path.join(__dirname, 'fixtures/multiple-negation'); const isIgnored = gitignore.sync({cwd}); const actual = [ '!!!unicorn.js', '!!unicorn.js', '!unicorn.js', 'unicorn.js' ].filter(file => !isIgnored(file)); const expected = ['!!unicorn.js', '!unicorn.js']; t.deepEqual(actual, expected); }); globby-7.1.1/index.js000066400000000000000000000062601320426074300144500ustar00rootroot00000000000000'use strict'; const arrayUnion = require('array-union'); const glob = require('glob'); const pify = require('pify'); const dirGlob = require('dir-glob'); const gitignore = require('./gitignore'); const globP = pify(glob); const DEFAULT_FILTER = () => false; const isNegative = pattern => pattern[0] === '!'; const assertPatternsInput = patterns => { if (!patterns.every(x => typeof x === 'string')) { throw new TypeError('Patterns must be a string or an array of strings'); } }; const generateGlobTasks = (patterns, taskOpts) => { patterns = [].concat(patterns); assertPatternsInput(patterns); const globTasks = []; taskOpts = Object.assign({ cache: Object.create(null), statCache: Object.create(null), realpathCache: Object.create(null), symlinks: Object.create(null), ignore: [], expandDirectories: true, nodir: true }, taskOpts); patterns.forEach((pattern, i) => { if (isNegative(pattern)) { return; } const ignore = patterns .slice(i) .filter(isNegative) .map(pattern => pattern.slice(1)); const opts = Object.assign({}, taskOpts, { ignore: taskOpts.ignore.concat(ignore) }); globTasks.push({pattern, opts}); }); return globTasks; }; const globDirs = (task, fn) => { if (Array.isArray(task.opts.expandDirectories)) { return fn(task.pattern, {files: task.opts.expandDirectories}); } if (typeof task.opts.expandDirectories === 'object') { return fn(task.pattern, task.opts.expandDirectories); } return fn(task.pattern); }; const getPattern = (task, fn) => task.opts.expandDirectories ? globDirs(task, fn) : [task.pattern]; module.exports = (patterns, opts) => { let globTasks; try { globTasks = generateGlobTasks(patterns, opts); } catch (err) { return Promise.reject(err); } const getTasks = Promise.all(globTasks.map(task => Promise.resolve(getPattern(task, dirGlob)) .then(globs => Promise.all(globs.map(glob => ({ pattern: glob, opts: task.opts })))) )) .then(tasks => arrayUnion.apply(null, tasks)); const getFilter = () => { return Promise.resolve( opts && opts.gitignore ? gitignore({cwd: opts.cwd, ignore: opts.ignore}) : DEFAULT_FILTER ); }; return getFilter() .then(filter => { return getTasks .then(tasks => Promise.all(tasks.map(task => globP(task.pattern, task.opts)))) .then(paths => arrayUnion.apply(null, paths)) .then(paths => paths.filter(p => !filter(p))); }); }; module.exports.sync = (patterns, opts) => { const globTasks = generateGlobTasks(patterns, opts); const getFilter = () => { return opts && opts.gitignore ? gitignore.sync({cwd: opts.cwd, ignore: opts.ignore}) : DEFAULT_FILTER; }; const tasks = globTasks.reduce((tasks, task) => { const newTask = getPattern(task, dirGlob.sync).map(glob => ({ pattern: glob, opts: task.opts })); return tasks.concat(newTask); }, []); const filter = getFilter(); return tasks.reduce( (matches, task) => arrayUnion(matches, glob.sync(task.pattern, task.opts)), [] ).filter(p => !filter(p)); }; module.exports.generateGlobTasks = generateGlobTasks; module.exports.hasMagic = (patterns, opts) => [] .concat(patterns) .some(pattern => glob.hasMagic(pattern, opts)); module.exports.gitignore = gitignore; globby-7.1.1/license000066400000000000000000000021251320426074300143440ustar00rootroot00000000000000MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. globby-7.1.1/package.json000066400000000000000000000025521320426074300152710ustar00rootroot00000000000000{ "name": "globby", "version": "7.1.1", "description": "Extends `glob` with support for multiple patterns and exposes a Promise API", "license": "MIT", "repository": "sindresorhus/globby", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", "url": "sindresorhus.com" }, "engines": { "node": ">=4" }, "scripts": { "bench": "npm update glob-stream fast-glob && matcha bench.js", "test": "xo && ava" }, "files": [ "index.js", "gitignore.js" ], "keywords": [ "all", "array", "directories", "dirs", "expand", "files", "filesystem", "filter", "find", "fnmatch", "folders", "fs", "glob", "globbing", "globs", "gulpfriendly", "match", "matcher", "minimatch", "multi", "multiple", "paths", "pattern", "patterns", "traverse", "util", "utility", "wildcard", "wildcards", "promise", "gitignore", "git" ], "dependencies": { "array-union": "^1.0.1", "dir-glob": "^2.0.0", "glob": "^7.1.2", "ignore": "^3.3.5", "pify": "^3.0.0", "slash": "^1.0.0" }, "devDependencies": { "ava": "*", "fast-glob": "^1.0.1", "glob-stream": "^6.1.0", "globby": "sindresorhus/globby#master", "matcha": "^0.7.0", "rimraf": "^2.2.8", "xo": "^0.18.0" } } globby-7.1.1/readme.md000066400000000000000000000104731320426074300145630ustar00rootroot00000000000000# globby [![Build Status](https://travis-ci.org/sindresorhus/globby.svg?branch=master)](https://travis-ci.org/sindresorhus/globby) > User-friendly glob matching Based on [`glob`](https://github.com/isaacs/node-glob), but adds a bunch of useful features and a nicer API. ## Features - Promise API - Multiple patterns - Negated patterns: `['foo*', '!foobar']` - Expands directories: `dir` → `dir/**/*` - Supports `.gitignore` ## Install ``` $ npm install globby ``` ## Usage ``` ├── unicorn ├── cake └── rainbow ``` ```js const globby = require('globby'); (async () => { const paths = await globby(['*', '!cake']); console.log(paths); //=> ['unicorn', 'rainbow'] })(); ``` ## API ### globby(patterns, [options]) Returns a `Promise` of matching paths. #### patterns Type: `string` `Array` See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage). #### options Type: `Object` See the [`node-glob` options](https://github.com/isaacs/node-glob#options) in addition to the ones below. One difference is that `nodir` is `true` by default here. ##### expandDirectories Type: `boolean` `Array` `Object`
Default: `true` If set to `true`, `globby` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `Object` with `files` and `extensions` like below: ```js (async () => { const paths = await globby('images', { expandDirectories: { files: ['cat', 'unicorn', '*.jpg'], extensions: ['png'] } }); console.log(paths); //=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg'] })(); ``` Note that if you set this option to `false`, you won't get back matched directories unless you set `nodir: false`. ##### gitignore Type: `boolean`
Default: `false` Respect ignore patterns in `.gitignore` files that apply to the globbed files. ### globby.sync(patterns, [options]) Returns an `Array` of matching paths. ### globby.generateGlobTasks(patterns, [options]) Returns an `Array` in the format `{pattern: string, opts: Object}`, which can be passed as arguments to [`node-glob`](https://github.com/isaacs/node-glob). This is useful for other globbing-related packages. Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration. ### globby.hasMagic(patterns, [options]) Returns a `boolean` of whether there are any special glob characters in the `patterns`. Note that the options affect the results. If `noext: true` is set, then `+(a|b)` will not be considered a magic pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`, then that is considered magical, unless `nobrace: true` is set. ### globby.gitignore([options]) Returns a `Promise<(path: string) => boolean>` indicating wether a given path is ignored via a `.gitignore` file. Takes `cwd?: string` and `ignore?: string[]` as options. `.gitignore` files matched by the ignore config are not used for the resulting filter function. ```js const {gitignore} = require('globby'); (async () => { const isIgnored = await gitignore(); console.log(isIgnored('some/file')); })(); ``` ### globby.gitignore.sync([options]) Returns a `(path: string) => boolean` indicating wether a given path is ignored via a `.gitignore` file. Takes the same options as `globby.gitignore`. ## Globbing patterns Just a quick overview. - `*` matches any number of characters, but not `/` - `?` matches a single character, but not `/` - `**` matches any number of characters, including `/`, as long as it's the only thing in a path part - `{}` allows for a comma-separated list of "or" expressions - `!` at the beginning of a pattern will negate the match [Various patterns and expected matches.](https://github.com/sindresorhus/multimatch/blob/master/test/test.js) ## Related - [multimatch](https://github.com/sindresorhus/multimatch) - Match against a list instead of the filesystem - [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching - [del](https://github.com/sindresorhus/del) - Delete files and directories - [make-dir](https://github.com/sindresorhus/make-dir) - Make a directory and its parents if needed ## License MIT © [Sindre Sorhus](https://sindresorhus.com) globby-7.1.1/test.js000066400000000000000000000114471320426074300143230ustar00rootroot00000000000000import fs from 'fs'; import path from 'path'; import test from 'ava'; import m from '.'; const cwd = process.cwd(); const fixture = [ 'a.tmp', 'b.tmp', 'c.tmp', 'd.tmp', 'e.tmp' ]; test.before(() => { if (!fs.existsSync('tmp')) { fs.mkdirSync('tmp'); } fixture.forEach(fs.writeFileSync.bind(fs)); fixture.forEach(x => fs.writeFileSync(path.join(__dirname, 'tmp', x))); }); test.after(() => { fixture.forEach(fs.unlinkSync.bind(fs)); fixture.forEach(x => fs.unlinkSync(path.join(__dirname, 'tmp', x))); fs.rmdirSync('tmp'); }); test('glob - async', async t => { t.deepEqual(await m('*.tmp'), ['a.tmp', 'b.tmp', 'c.tmp', 'd.tmp', 'e.tmp']); }); test('glob - async - multiple file paths', t => { t.deepEqual(m.sync(['a.tmp', 'b.tmp']), ['a.tmp', 'b.tmp']); }); test('glob with multiple patterns - async', async t => { t.deepEqual(await m(['a.tmp', '*.tmp', '!{c,d,e}.tmp']), ['a.tmp', 'b.tmp']); }); test('respect patterns order - async', async t => { t.deepEqual(await m(['!*.tmp', 'a.tmp']), ['a.tmp']); }); test('glob - sync', t => { t.deepEqual(m.sync('*.tmp'), ['a.tmp', 'b.tmp', 'c.tmp', 'd.tmp', 'e.tmp']); t.deepEqual(m.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']), ['a.tmp', 'b.tmp']); t.deepEqual(m.sync(['!*.tmp', 'a.tmp']), ['a.tmp']); }); test('glob - sync - multiple file paths', t => { t.deepEqual(m.sync(['a.tmp', 'b.tmp']), ['a.tmp', 'b.tmp']); }); test('return [] for all negative patterns - sync', t => { t.deepEqual(m.sync(['!a.tmp', '!b.tmp']), []); }); test('return [] for all negative patterns - async', async t => { t.deepEqual(await m(['!a.tmp', '!b.tmp']), []); }); test('cwd option', t => { process.chdir('tmp'); t.deepEqual(m.sync('*.tmp', {cwd}), ['a.tmp', 'b.tmp', 'c.tmp', 'd.tmp', 'e.tmp']); t.deepEqual(m.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp'], {cwd}), ['a.tmp', 'b.tmp']); process.chdir(cwd); }); test(`don't mutate the options object - async`, async t => { await m(['*.tmp', '!b.tmp'], Object.freeze({ignore: Object.freeze([])})); t.pass(); }); test(`don't mutate the options object - sync`, t => { m.sync(['*.tmp', '!b.tmp'], Object.freeze({ignore: Object.freeze([])})); t.pass(); }); test('expose generateGlobTasks', t => { const tasks = m.generateGlobTasks(['*.tmp', '!b.tmp'], {ignore: ['c.tmp']}); t.is(tasks.length, 1); t.is(tasks[0].pattern, '*.tmp'); t.deepEqual(tasks[0].opts.ignore, ['c.tmp', 'b.tmp']); }); test('expose hasMagic', t => { t.true(m.hasMagic('**')); t.true(m.hasMagic(['**', 'path1', 'path2'])); t.false(m.hasMagic(['path1', 'path2'])); }); test('expandDirectories option', t => { t.deepEqual(m.sync('tmp'), ['tmp/a.tmp', 'tmp/b.tmp', 'tmp/c.tmp', 'tmp/d.tmp', 'tmp/e.tmp']); t.deepEqual(m.sync('tmp', {expandDirectories: ['a*', 'b*']}), ['tmp/a.tmp', 'tmp/b.tmp']); t.deepEqual(m.sync('tmp', { expandDirectories: { files: ['a', 'b'], extensions: ['tmp'] } }), ['tmp/a.tmp', 'tmp/b.tmp']); t.deepEqual(m.sync('tmp', { expandDirectories: { files: ['a', 'b'], extensions: ['tmp'] }, ignore: ['**/b.tmp'] }), ['tmp/a.tmp']); }); // Rejected for being an invalid pattern [ {}, [{}], true, [true], false, [false], null, [null], undefined, [undefined], NaN, [NaN], 5, [5], function () {}, [function () {}] ].forEach(v => { const valstring = v === undefined ? 'undefined' : (JSON.stringify(v) || v.toString()); const msg = 'Patterns must be a string or an array of strings'; test(`rejects the promise for invalid patterns input: ${valstring} - async`, async t => { await t.throws(m(v), TypeError); await t.throws(m(v), msg); }); test(`throws for invalid patterns input: ${valstring}`, t => { t.throws(() => m.sync(v), TypeError); t.throws(() => m.sync(v), msg); }); test(`generateGlobTasks throws for invalid patterns input: ${valstring}`, t => { t.throws(() => m.generateGlobTasks(v), TypeError); t.throws(() => m.generateGlobTasks(v), msg); }); }); test('gitignore option defaults to false', async t => { const actual = await m('*', {nodir: false}); t.true(actual.indexOf('node_modules') > -1); }); test('gitignore option defaults to false - sync', t => { const actual = m.sync('*', {nodir: false}); t.true(actual.indexOf('node_modules') > -1); }); test('respects gitignore option true', async t => { const actual = await m('*', {gitignore: true, nodir: false}); t.false(actual.indexOf('node_modules') > -1); }); test('respects gitignore option true - sync', t => { const actual = m.sync('*', {gitignore: true, nodir: false}); t.false(actual.indexOf('node_modules') > -1); }); test('respects gitignore option false', async t => { const actual = await m('*', {gitignore: false, nodir: false}); t.true(actual.indexOf('node_modules') > -1); }); test('respects gitignore option false - sync', t => { const actual = m.sync('*', {gitignore: false, nodir: false}); t.true(actual.indexOf('node_modules') > -1); });