From 72e775a8ca2ddd4452817eb7b77b3aa658acec8d Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Mon, 6 Jan 2020 03:33:05 -0500 Subject: [PATCH] Fix using `gitignore` and `absolute` options at the same time on Windows (#137) --- gitignore.js | 2 +- test.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gitignore.js b/gitignore.js index 8024ffc..3feaad6 100644 --- a/gitignore.js +++ b/gitignore.js @@ -83,7 +83,7 @@ const getFileSync = (file, cwd) => { const normalizeOptions = ({ ignore = [], - cwd = process.cwd() + cwd = slash(process.cwd()) } = {}) => { return {ignore, cwd}; }; diff --git a/test.js b/test.js index 165d46a..68749b1 100644 --- a/test.js +++ b/test.js @@ -298,6 +298,11 @@ test('gitignore option with stats option', async t => { t.false(actual.includes('node_modules')); }); +test('gitignore option with absolute option', async t => { + const result = await globby('*', {gitignore: true, absolute: true}); + t.false(result.includes('node_modules')); +}); + test('respects gitignore option false - stream', async t => { const actual = await getStream.array(globby.stream('*', {gitignore: false, onlyFiles: false})); t.true(actual.includes('node_modules'));