exports[name] = function (test) { var r = raw.Redis (6379) //there is a bug in parallel.map if there is only one iteration and it errors... ctrl.parallel.map(r.req) (example.input, function (err, actual) { r.socket.end() r.socket.once('end', test.done) if(!Array.isArray(example.expected)) it(err).equal(example.expected) else { if(err) throw err it(actual).deepEqual(example.expected) } }) }
ls(tests, lsOpts, function (err, tests) { tests = d.filter(tests, /\.js$/) console.log('POST',tests, process.cwd()) if(isolate && tests.length > 1) { //run same node command again, but with only one test var _cmd = process.argv[1] , ctrl = require('ctrlflow') , started = {} ctrl.parallel.map(function (test, callback) { started[test] = true var child = require('./runner').runCP(_cmd, test, opts, function (err, report) { started[test] = false report.name = test reporter.test(report) callback(err, report) }) console.log('isolating', test, "in", child.pid) })(tests, function (err) { if(err) reporter.error(err, 'strange') // the process will exit when the event loop empties // which should be right after this! // if it isn't, something has been left dangling open // or there is a still running timout or interval. }) shutdowns = [function () { d.map(started, function (notFinished, test) { if(notFinished) reporter.test(test, 'was started but did not finish') }) }] } else { shutdowns = tests.map(function (file) { return run(file, function loader(file) { return require(file) }, adapter, tests.length > 1 ? reporter.subreport(file) : reporter) }) } })