sh.ls() fails when stack sized is reached for deep recursive listings: RangeError: Maximum call stack size exceeded

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-07-21 13:17:16 -04:00
parent 10f1f43d93
commit 064e986d26
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,28 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js');
var expect = require('chai').expect;
describe('sh.ls and deep directory trees', function() {
beforeEach(util.setup);
afterEach(util.cleanup);
it('should not crash when calling sh.ls() on deep directory layouts', function(done) {
var fs = util.fs();
var sh = fs.Shell();
// The specific depth at which this will fail is based on the depth
// of the call stack, since sh.ls() is recursive, so it can be less
// than this in some cases, but this should trigger it in *this* case.
var path = '/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20';
sh.mkdirp(path, function(err) {
if(err) throw err;
sh.ls('/', {recursive: true}, function(err, listing) {
expect(err).not.to.exist;
expect(listing).to.exist;
done();
});
});
});
});

View File

@ -68,3 +68,4 @@ require("./spec/node-js/simple/test-fs-watch-recursive");
require("./bugs/issue105");
require("./bugs/issue106");
require("./bugs/issue239");
require("./bugs/ls-depth-bug");