Skip to content

Commit

Permalink
Refactor test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
JPeer264 committed Feb 27, 2017
1 parent 7bddeb5 commit 2c78eec
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions 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))
})
})

0 comments on commit 2c78eec

Please sign in to comment.