diff options
| author | Florian Dold <florian.dold@gmail.com> | 2017-05-03 15:35:00 +0200 |
|---|---|---|
| committer | Florian Dold <florian.dold@gmail.com> | 2017-05-03 15:35:00 +0200 |
| commit | de98e0b232509d5f40c135d540a70e415272ff85 (patch) | |
| tree | a79222a5b58484ab3b80d18efcaaa7ccc4769b33 /node_modules/walkdir/test/nofailemptydir.js | |
| parent | e0c9d480a73fa629c1e4a47d3e721f1d2d345406 (diff) | |
node_modules
Diffstat (limited to 'node_modules/walkdir/test/nofailemptydir.js')
| -rw-r--r-- | node_modules/walkdir/test/nofailemptydir.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/node_modules/walkdir/test/nofailemptydir.js b/node_modules/walkdir/test/nofailemptydir.js new file mode 100644 index 000000000..9a9215a26 --- /dev/null +++ b/node_modules/walkdir/test/nofailemptydir.js @@ -0,0 +1,34 @@ +var test = require('tape'), +fs = require('fs'), +path = require('path'), +walk = require('../walkdir.js'); + +test('should not emit fail events for empty dirs',function(t){ + fs.mkdir('./empty',function(err,data){ + if(err) { + t.equals(err.code,'EEXIST','if error code on mkdir for fixture it should only be because it exists already'); + } + + var paths = []; + var dirs = []; + var emptys = []; + var fails = []; + + var em = walk('./'); + + em.on('fail',function(path,err){ + fails.push(path); + }); + + em.on('empty',function(path,err){ + emptys.push(path); + }); + + em.on('end',function(){ + t.equals(fails.length,0,'should not have any fails'); + t.equals(path.basename(emptys[0]),'empty','should find empty dir'); + t.end(); + }); + }); +}); + |
