diff --git a/test.js b/test.js index 1877731c..659ea683 100644 --- a/test.js +++ b/test.js @@ -1,30 +1,31 @@ -var os = require('os') -var path = require('path') -var Mocha = require('mocha') -var assign = require('./lib/util/assign') -var klaw = require('klaw') +'use strict' -var argv = require('minimist')(process.argv.slice(2)) +const os = require('os') +const path = require('path') +const klaw = require('klaw') +const Mocha = require('mocha') +const assign = require('./lib/util/assign') -var mochaOpts = assign({ +const argv = require('minimist')(process.argv.slice(2)) + +const mochaOpts = assign({ ui: 'bdd', reporter: 'dot', timeout: 30000 }, argv) -var mocha = new Mocha(mochaOpts) +const mocha = new Mocha(mochaOpts) +const testExt = '.test.js' klaw('./lib').on('readable', function () { - var item + let item while ((item = this.read())) { if (!item.stats.isFile()) return - if (item.path.lastIndexOf('.test.js') !== (item.path.length - '.test.js'.length)) return + if (item.path.lastIndexOf(testExt) !== (item.path.length - testExt.length)) return mocha.addFile(item.path) } -}).on('end', function () { - mocha.run(function (failures) { - require('./').remove(path.join(os.tmpdir(), 'fs-extra'), function () { - process.exit(failures) - }) +}).on('end', () => { + mocha.run(failures => { + require('./').remove(path.join(os.tmpdir(), 'fs-extra'), () => process.exit(failures)) }) })