5 var nodeunit = require('../nodeunit'),
6 path = require('path'),
7 assert = require('tap').assert,
8 TapProducer = require('tap').Producer;
11 * Reporter info string
14 exports.info = "TAP output";
17 * Run all tests within each module, reporting the results to the command-line.
19 * @param {Array} files
23 exports.run = function (files, options) {
26 // load default options
27 var content = fs.readFileSync(
28 __dirname + '/../../bin/nodeunit.json', 'utf8'
30 options = JSON.parse(content);
33 var paths = files.map(function (p) {
34 return path.join(process.cwd(), p);
36 var output = new TapProducer();
37 output.pipe(process.stdout);
39 nodeunit.runFiles(paths, {
40 testStart: function (name) {
41 output.write(name.toString());
43 testDone: function (name, assertions) {
44 assertions.forEach(function (e) {
49 message: e.error.message,
50 stack: e.error.stack.split(/\n/).filter(function (line) {
51 // exclude line of "types.js"
52 return ! RegExp(/types.js:83:39/).test(line);
55 extra.wanted = e.error.expected;
56 extra.found = e.error.actual;
58 output.write(assert(e.passed(), e.message, extra));
61 done: function (assertions) {