Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tape

Package Overview
Dependencies
Maintainers
1
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tape - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

test/harness.js

26

index.js

@@ -17,6 +17,2 @@ var createDefaultStream = require('./lib/default_stream');

var test = function (name, conf, cb) {
if (typeof conf === 'function') {
cb = conf;
conf = {};
}
var t = new Test(name, conf, cb);

@@ -41,10 +37,5 @@

t.on('test', function (st) {
pending.unshift(function () {
running = true;
out.push(st);
st.run();
st.on('end', onend);
});
t.on('test', function sub (st) {
st.on('test', sub);
st.on('end', onend);
});

@@ -56,2 +47,13 @@

running = false;
if (this._progeny.length) {
var unshifts = this._progeny.map(function (st) {
return function () {
running = true;
out.push(st);
st.run();
};
});
pending.unshift.apply(pending, unshifts);
}
process.nextTick(function () {

@@ -58,0 +60,0 @@ if (pending.length) pending.shift()()

@@ -30,2 +30,7 @@ var Stream = require('stream');

t.on('result', function (res) {
if (typeof res === 'string') {
self.emit('data', '# ' + res + '\n');
return;
}
self.emit('data', encodeResult(res, self.count + 1));

@@ -32,0 +37,0 @@ self.count ++;

@@ -34,2 +34,3 @@ var EventEmitter = require('events').EventEmitter;

this._cb = cb;
this._progeny = [];
}

@@ -46,9 +47,9 @@

Test.prototype.test = function (name, opts, cb) {
var self = this;
var t = new Test(name, opts, cb);
self.emit('test', t);
this._progeny.push(t);
this.emit('test', t);
};
Test.prototype.comment = function (msg) {
this.result('\n' + msg.trim());
this.emit('result', msg.trim().replace(/^#\s*/, ''));
};

@@ -55,0 +56,0 @@

{
"name" : "tape",
"version" : "0.0.1",
"version" : "0.0.2",
"description" : "tap-producing test harness for node and browsers",

@@ -5,0 +5,0 @@ "main" : "index.js",

@@ -19,2 +19,34 @@ var test = require('../');

var grandParentRan = false;
var parentRan = false;
var grandChildRan = false;
test('grandparent', function(t) {
grandParentRan = true;
t.test('parent', function(t) {
parentRan = true;
t.test('grandchild', function(t) {
grandChildRan = true;
t.pass('grand child ran');
t.end();
});
t.pass('parent ran');
t.end();
});
t.test('other parent', function(t) {
t.ok(parentRan, 'first parent runs before second parent');
t.ok(grandChildRan, 'grandchild runs before second parent');
t.end();
});
t.pass('grandparent ran');
t.end();
});
test('second grandparent', function(t) {
t.ok(grandParentRan, 'grandparent ran');
t.ok(parentRan, 'parent ran');
t.ok(grandChildRan, 'grandchild ran');
t.pass('other grandparent ran');
t.end();
});
// vim: set softtabstop=4 shiftwidth=4:
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc