test.js: windows test script

This commit is contained in:
JP Richardson 2015-06-17 09:12:18 -05:00
parent 96eb8a3b8e
commit 3d3f050741
2 changed files with 27 additions and 1 deletions

View File

@ -50,6 +50,6 @@
"coverage": "istanbul cover ./node_modules/.bin/_mocha --recursive -- --reporter list",
"coveralls": "npm run coverage && coveralls < coverage/lcov.info",
"test": "standard && mocha test",
"test-windows": "Get-ChildItem -Path .\\test\\ -Filter *.test.js -Recurse | %{mocha $_}"
"test-windows": "node test.js"
}
}

26
test.js Normal file
View File

@ -0,0 +1,26 @@
var Mocha = require('mocha')
var walk = require('./lib/walk/')
var mocha = new Mocha({
ui: 'bdd',
reporter: 'spec',
timeout: 30000,
})
var filter = function (item, stat) {
if (stat.isDirectory()) return true
return item.lastIndexOf('.test.js') === (item.length - '.test.js'.length)
}
var walker = walk('./test', filter)
.on('data', function (item, stat) {
if (!stat.isFile()) return
mocha.addFile(item)
})
.on('end', function () {
mocha.run(function(failures){
process.exit(failures);
})
})