Skip to content

Commit

Permalink
Fix gitignore option compatibility with objectMode option (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
LKummer authored Jan 6, 2021
1 parent 7807d29 commit f9fc476
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gitignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
12 changes: 12 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('*', {
Expand Down

0 comments on commit f9fc476

Please sign in to comment.