This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
node-task/node_modules/require-dir/test/recurse.js

25 lines
490 B
JavaScript

var assert = require('assert');
var requireDir = require('..');
// first test without recursing:
assert.deepEqual(requireDir('./recurse'), {
a: 'a',
});
// then test with recursing:
assert.deepEqual(requireDir('./recurse', {recurse: true}), {
a: 'a',
b: {
'1': {
foo: 'foo',
bar: 'bar',
},
'2': {} // note how the directory is always returned
},
c: {
'3': 3
},
});
console.log('Recurse tests passed.');