Skip to content

Commit af5d139

Browse files
author
Rick
authoredFeb 11, 2024
Fix expandDirectories.extension option (#263)
1 parent 3a28601 commit af5d139

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const getDirectoryGlob = ({directoryPath, files, extensions}) => {
2727
const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]}` : '';
2828
return files
2929
? files.map(file => nodePath.posix.join(directoryPath, `**/${nodePath.extname(file) ? file : `${file}${extensionGlob}`}`))
30-
: [nodePath.posix.join(directoryPath, `**${extensionGlob ? `/${extensionGlob}` : ''}`)];
30+
: [nodePath.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ''}`)];
3131
};
3232

3333
const directoryToGlob = async (directoryPaths, {

‎tests/globby.js

+5
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ test('expandDirectories option', async t => {
165165
},
166166
ignore: ['**/b.tmp'],
167167
}), ['tmp/a.tmp']);
168+
t.deepEqual(await runGlobby(t, temporary, {
169+
expandDirectories: {
170+
extensions: ['tmp'],
171+
},
172+
}), ['tmp/a.tmp', 'tmp/b.tmp', 'tmp/c.tmp', 'tmp/d.tmp', 'tmp/e.tmp']);
168173
});
169174

170175
test('expandDirectories:true and onlyFiles:true option', async t => {

0 commit comments

Comments
 (0)
Please sign in to comment.