diff --git a/src/index.ts b/src/index.ts index 56c233a..d1fd16e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -122,7 +122,7 @@ function processPatterns( split[split.length - 2] = '**'; split.pop(); } - transformed.push(split.join('/')); + transformed.push(split.length ? split.join('/') : '*'); } else { transformed.push(split.length > 1 ? split.slice(0, -1).join('/') : split.join('/')); } diff --git a/test/index.test.ts b/test/index.test.ts index bd4157c..2fc4fdb 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -26,6 +26,12 @@ const cwd = fixture.path; after(() => fixture.rm()); +test('only double star', async () => { + const files = await glob({ patterns: ['**'], cwd }); + assert.deepEqual(files.sort(), ['a/a.txt', 'a/b.txt', 'b/a.txt', 'b/b.txt']); +}); + + test('directory expansion', async () => { const files = await glob({ patterns: ['a'], cwd }); assert.deepEqual(files.sort(), ['a/a.txt', 'a/b.txt']);