diff --git a/gitignore.js b/gitignore.js index e85792d..95227a1 100644 --- a/gitignore.js +++ b/gitignore.js @@ -59,7 +59,7 @@ const ensureAbsolutePathForCwd = (cwd, p) => { }; const getIsIgnoredPredecate = (ignores, cwd) => { - return p => ignores.ignores(slash(path.relative(cwd, ensureAbsolutePathForCwd(cwd, p)))); + return p => ignores.ignores(slash(path.relative(cwd, ensureAbsolutePathForCwd(cwd, p.path || p)))); }; const getFile = async (file, cwd) => { diff --git a/test.js b/test.js index 6e20df0..c73fbdb 100644 --- a/test.js +++ b/test.js @@ -303,6 +303,18 @@ test('respects gitignore option false - stream', async t => { t.true(actual.includes('node_modules')); }); +test('gitingore option and objectMode option - async', async t => { + const result = await globby('fixtures/gitignore/*', {gitignore: true, objectMode: true}); + t.is(result.length, 1); + t.truthy(result[0].path); +}); + +test('gitingore option and objectMode option - sync', t => { + const result = globby.sync('fixtures/gitignore/*', {gitignore: true, objectMode: true}); + t.is(result.length, 1); + t.truthy(result[0].path); +}); + test('`{extension: false}` and `expandDirectories.extensions` option', t => { t.deepEqual( globby.sync('*', {