Comparing version 0.0.0 to 0.0.1
@@ -7,7 +7,7 @@ var test = require('../'); | ||
t.equal(typeof Date.now, 'function'); | ||
var start = Date.now(); | ||
var start = new Date; | ||
setTimeout(function () { | ||
t.equal(Date.now() - start, 100); | ||
t.equal(new Date - start, 100); | ||
}, 100); | ||
}); |
@@ -21,4 +21,3 @@ var createDefaultStream = require('./lib/default_stream'); | ||
} | ||
var t = new Test; | ||
t.name = name; | ||
var t = new Test(name, conf, cb); | ||
@@ -33,6 +32,6 @@ process.nextTick(function () { | ||
out.push(t); | ||
cb(t); | ||
t.run(); | ||
}; | ||
if (running) { | ||
if (running || pending.length) { | ||
pending.push(run); | ||
@@ -67,1 +66,3 @@ } | ||
} | ||
// vim: set softtabstop=4 shiftwidth=4: |
@@ -9,4 +9,20 @@ var EventEmitter = require('events').EventEmitter; | ||
function Test (name, opts) { | ||
if (!opts) opts = {}; | ||
function Test (name_, opts_, cb_) { | ||
var name = '(anonymous)'; | ||
var opts = {}; | ||
var cb; | ||
for (var i = 0; i < arguments.length; i++) { | ||
switch (typeof arguments[i]) { | ||
case 'string': | ||
name = arguments[i]; | ||
break; | ||
case 'object': | ||
opts = arguments[i] || opts; | ||
break; | ||
case 'function': | ||
cb = arguments[i]; | ||
} | ||
} | ||
EventEmitter.call(this); | ||
@@ -16,14 +32,18 @@ | ||
this.assertCount = 0; | ||
this._skip = opts.skip || false; | ||
this._plan = undefined; | ||
this._cb = cb; | ||
} | ||
Test.prototype.test = function (name, cb) { | ||
Test.prototype.run = function () { | ||
if (this._skip) { | ||
this.end(); | ||
} else { | ||
this._cb(this); | ||
} | ||
}; | ||
Test.prototype.test = function (name, opts, cb) { | ||
var self = this; | ||
if (typeof name === 'function') { | ||
cb = name; | ||
name = '(anonymous)'; | ||
} | ||
var t = new Test(name); | ||
t.run = function () { cb(t) }; | ||
var t = new Test(name, opts, cb); | ||
self.emit('test', t); | ||
@@ -43,3 +63,4 @@ }; | ||
if (!this.ended) this.emit('end'); | ||
if (!this._planError && this.assertCount !== this._plan) { | ||
if (this._plan !== undefined && | ||
!this._planError && this.assertCount !== this._plan) { | ||
this._planError = true; | ||
@@ -115,3 +136,3 @@ this.fail('plan != count', { | ||
Test.prototype.ok | ||
= Test.prototype.true | ||
= Test.prototype['true'] | ||
= Test.prototype.assert | ||
@@ -265,1 +286,3 @@ = function (value, msg, extra) { | ||
}; | ||
// vim: set softtabstop=4 shiftwidth=4: |
{ | ||
"name" : "tape", | ||
"version" : "0.0.0", | ||
"version" : "0.0.1", | ||
"description" : "tap-producing test harness for node and browsers", | ||
@@ -5,0 +5,0 @@ "main" : "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32419
26
895
173
10