forked from jprichardson/node-fs-extra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
31 lines (26 loc) · 769 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict'
const os = require('os')
const path = require('path')
const klaw = require('klaw')
const Mocha = require('mocha')
const assign = require('./lib/util/assign')
const argv = require('minimist')(process.argv.slice(2))
const mochaOpts = assign({
ui: 'bdd',
reporter: 'dot',
timeout: 30000
}, argv)
const mocha = new Mocha(mochaOpts)
const testExt = '.test.js'
klaw('./lib').on('readable', function () {
let item
while ((item = this.read())) {
if (!item.stats.isFile()) return
if (item.path.lastIndexOf(testExt) !== (item.path.length - testExt.length)) return
mocha.addFile(item.path)
}
}).on('end', () => {
mocha.run(failures => {
require('./').remove(path.join(os.tmpdir(), 'fs-extra'), () => process.exit(failures))
})
})