Skip to content

Commit

Permalink
Make scan work with noext
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark1626 committed Sep 28, 2019
1 parent 0f0db08 commit 6c02e03
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ module.exports = (input, options) => {
}
}

if (opts.noext === true) {
isGlob = false;
}

let prefix = '';
const orig = input;
let base = input;
Expand Down
11 changes: 11 additions & 0 deletions test/api.scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ describe('picomatch', () => {
assert.equal(base('path/foo/'), 'path/foo/');
assert.equal(base('path/foo/bar.js'), 'path/foo/bar.js');
});

it('should not return glob when noext is true', () => {
assert.deepEqual(scan('./foo/bar/*.js', {noext: true }), {
input: './foo/bar/*.js',
glob: '',
isGlob: false,
base: 'foo/bar/*.js',
negated: false,
prefix: './'
});
});
});

describe('.base (glob2base test patterns)', () => {
Expand Down

0 comments on commit 6c02e03

Please sign in to comment.