mirror of
https://github.com/jprichardson/node-fs-extra.git
synced 2026-01-25 16:42:57 +00:00
This commit ensures that tests are:
- only found in `fs-extra/lib`
- found even if `fs-extra` is in a `node_modules` folder
25 lines
578 B
JavaScript
25 lines
578 B
JavaScript
var os = require('os')
|
|
var path = require('path')
|
|
var Mocha = require('mocha')
|
|
var walk = require('./lib/walk/')
|
|
|
|
var mocha = new Mocha({
|
|
ui: 'bdd',
|
|
reporter: 'dot',
|
|
timeout: 30000
|
|
})
|
|
|
|
walk('./lib')
|
|
.on('data', function (item, stat) {
|
|
if (!stat.isFile()) return
|
|
if (item.lastIndexOf('.test.js') !== (item.length - '.test.js'.length)) return
|
|
mocha.addFile(item)
|
|
})
|
|
.on('end', function () {
|
|
mocha.run(function (failures) {
|
|
require('./').remove(path.join(os.tmpdir(), 'fs-extra'), function () {
|
|
process.exit(failures)
|
|
})
|
|
})
|
|
})
|