-
Notifications
You must be signed in to change notification settings - Fork 129
Open
Description
Environment
- OS Version: Windows 11
- Node.js Version: v22.3.0
Actual && Expected behavior
Question: How to match all the files (e.g. .jpg
) in D:/
?
For test cases 1 and 2: after adding D:
, the matching failed.
For test cases 2 and 7: matching on another drive will success.
For test cases 2 and 4 (or 5 and 6): after adding photos/
, the matching will success. (But why?)
It seems it's an unexpected behavior.
// npm install --save fast-glob mock-fs
const fg = require('fast-glob');
const mock = require('mock-fs');
mock({
'D:/photos/image1.jpg': '',
'E:/hello/world.txt':'',
'index.js': '',
})
// 1. correct result: [ 'D:/photos/image1.jpg', 'D:/code/test-glob/index.js' ]
console.log(fg.globSync(['/**/*'], { absolute: true, }));
// 2. unexpected result: [ 'D:/index.js' ]
console.log(fg.globSync(['D:/**/*'], { absolute: true, }));
// 3. unexpected result: [ 'D:/index.js' ]
console.log(fg.globSync(['D:\/**/*'], { absolute: true, }));
// 4. correct result: [ 'D:/photos/**/*' ]
console.log(fg.globSync(['D:/photos/**/*'], { absolute: true, }));
// 5. unexpected result: [ 'D:/index.js' ]
console.log(fg.globSync([fg.convertPathToPattern('D:\\**\\*')], { absolute: true, }));
// 6. correct result: [ 'D:/photos/image1.jpg' ]
console.log(fg.globSync([fg.convertPathToPattern('D:\\photos\\**\\*')], { absolute: true, }));
// 7. correct result: [ 'E:/hello/world.txt' ]
console.log(fg.globSync(['E:/**/*'], { absolute: true, }));
Metadata
Metadata
Assignees
Labels
No labels