diff --git a/index.js b/index.js index 9f96bdd..a7c33d1 100644 --- a/index.js +++ b/index.js @@ -6,7 +6,10 @@ var requires = {}; if (arguments.length === 1) { - fs.readdirSync(dir).forEach(function(filename) { + var files = fs.readdirSync(dir); + files.sort(function(a,b) { return a.toLowerCase() - b.toLowerCase() }); + + files.forEach(function(filename) { if ((filename === 'index.js') || (filename[0] === '_')) { return; } diff --git a/test/test.js b/test/test.js index 7283409..d0769dc 100644 --- a/test/test.js +++ b/test/test.js @@ -21,7 +21,9 @@ try { assert.equal(('_private' in lib), false); assert.equal(('ignored' in lib.bar.fed), false); - + + assert.equal(Object.keys(lib)[0], 'bam'); + console.log("All tests passed."); } catch (error) {