Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gitignore option compatibility with objectMode option #157

Merged
merged 3 commits into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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