Closed iamssen closed 4 years ago
const mock = require('mock-fs'); const glob = require('glob'); const fs = require('fs'); // Real file test console.log(fs.existsSync('sample/test1/package.json')); console.log(fs.existsSync('sample/test1/package.json/package.json')); console.log(glob.sync('sample/**/package.json')); // mock-fs test mock({ sample: { 'test1': { 'package.json': '' }, 'test2': { 'package.json': '' }, '@test': { test3: { 'package.json': '' }, test4: { 'package.json': '' }, } } }); console.log(fs.existsSync('sample/test1/package.json')); console.log(fs.existsSync('sample/test1/package.json/package.json')); console.log(glob.sync('sample/**/package.json'));
true false [ 'sample/@test/test3/package.json', 'sample/@test/test4/package.json', 'sample/test1/package.json', 'sample/test2/package.json' ] true false [ 'sample/@test/test3/package.json', 'sample/@test/test3/package.json/package.json', 'sample/@test/test4/package.json', 'sample/@test/test4/package.json/package.json', 'sample/test1/package.json', 'sample/test1/package.json/package.json', 'sample/test2/package.json', 'sample/test2/package.json/package.json' ]
I get this result when I run the test code.
I am not sure whether this is a mock-fs problem or a glob problem.
+1 any way to fix it?
It looks like this is fixed in latest v4.10.4. @iamssen pls close this issue if you can confirm.
I get this result when I run the test code.
I am not sure whether this is a mock-fs problem or a glob problem.