forked from jprichardson/node-fs-extra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
30 lines (26 loc) · 751 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
var os = require('os')
var path = require('path')
var Mocha = require('mocha')
var assign = require('./lib/util/assign')
var fs = require('./')
var argv = require('minimist')(process.argv.slice(2))
var mochaOpts = assign({
ui: 'bdd',
reporter: 'dot',
timeout: 30000
}, argv)
var mocha = new Mocha(mochaOpts)
fs.walk('./lib').on('readable', function () {
var item
while ((item = this.read())) {
if (!item.stats.isFile()) return
if (item.path.lastIndexOf('.test.js') !== (item.path.length - '.test.js'.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)
})
})
})