diff --git a/index.js b/index.js index 450559a..1847350 100644 --- a/index.js +++ b/index.js @@ -27,7 +27,7 @@ const getDirectoryGlob = ({directoryPath, files, extensions}) => { const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]}` : ''; return files ? files.map(file => nodePath.posix.join(directoryPath, `**/${nodePath.extname(file) ? file : `${file}${extensionGlob}`}`)) - : [nodePath.posix.join(directoryPath, `**${extensionGlob ? `/${extensionGlob}` : ''}`)]; + : [nodePath.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ''}`)]; }; const directoryToGlob = async (directoryPaths, { diff --git a/tests/globby.js b/tests/globby.js index 127b0f0..e2067a6 100644 --- a/tests/globby.js +++ b/tests/globby.js @@ -165,6 +165,11 @@ test('expandDirectories option', async t => { }, ignore: ['**/b.tmp'], }), ['tmp/a.tmp']); + t.deepEqual(await runGlobby(t, temporary, { + expandDirectories: { + extensions: ['tmp'], + }, + }), ['tmp/a.tmp', 'tmp/b.tmp', 'tmp/c.tmp', 'tmp/d.tmp', 'tmp/e.tmp']); }); test('expandDirectories:true and onlyFiles:true option', async t => {