node-fs-extra/test.js
Ryan Zimmerman 3c3865cad8
BREAKING: Drop old Node support (#751)
* BREAKING: Drop old Node support, require v10+

Update CI configs

* Remove references and test fencing for old Node versions

* Use object spread properties

* Use octal literal notation

* Use optional catch bindings
2020-02-04 17:30:40 -05:00

32 lines
722 B
JavaScript

'use strict'
const os = require('os')
const path = require('path')
const klaw = require('klaw')
const Mocha = require('mocha')
const argv = require('minimist')(process.argv.slice(2))
const mochaOpts = {
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))
})
})