UNPKG

678 BJavaScriptView Raw
1var assert = require('assert');
2var find = require('findit');
3
4exports.module = function () {
5 assert.eql(find.findSync, find.find.sync);
6 assert.eql(find, find.find);
7};
8
9exports.file = function () {
10 var to = setTimeout(function () {
11 assert.fail('never ended');
12 }, 5000);
13
14 var finder = find(__filename);
15 var files = [];
16 finder.on('file', function (file) {
17 assert.equal(file, __filename);
18 files.push(file);
19 });
20
21 finder.on('directory', function (dir) {
22 assert.fail(dir);
23 });
24
25 finder.on('end', function () {
26 clearTimeout(to);
27 assert.deepEqual(files, [ __filename ]);
28 });
29};