Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Commit

Permalink
Removing tap-finished
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvaincombes committed Sep 3, 2015
1 parent eb361b6 commit ed9007d
Showing 1 changed file with 0 additions and 56 deletions.
56 changes: 0 additions & 56 deletions frameworks/tape/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,6 @@ if (typeof global.console === 'undefined') {
global.console = {};
}

var finished = function (opts, cb) {
if (typeof opts === 'function') {
cb = opts;
opts = {};
}
if (!opts) opts = {};
if (opts.wait === undefined) opts.wait = 1000;

var p = parser();
var seen = { plan: null, asserts: 0 };
var finished = false;
var ended = false;

p.on('end', function () { ended = true });

p.on('assert', function (a) {
seen.asserts ++;
check();
});

p.on('plan', function (plan) {
seen.plan = plan.end - plan.start;
check();
});

p.on('results', function () {
if (finished) return;
finish();
});

return p;

function check () {
if (finished) return;
if (seen.plan === null || seen.asserts < seen.plan) return;
finish();
}

function finish () {
finished = true;

p.on('results', cb);
if (opts.wait && !ended) {
setTimeout(function () { p.end() }, opts.wait);
}
else p.end();
}
};

var reporter = ZuulReporter(run);
var previous_test = undefined;
var assertions = 0;
Expand All @@ -63,20 +14,13 @@ var noMoreTests = false;

var parse_stream = parser();

var finished_stream = finished(function() {
done = true;
parse_stream.end();
reporter.done();
});

var originalLog = global.console.log;
global.console.log = function () {
var msg = arguments[0];

// do not write in a closed WriteStream
if (!done) {
parse_stream.write(msg + '\n');
finished_stream.write(msg + '\n');
}

// transfer log to original console,
Expand Down

0 comments on commit ed9007d

Please sign in to comment.