Comparing version 0.0.11 to 0.1.0
@@ -1,33 +0,37 @@ | ||
{ "name": "test" | ||
, "version": "0.0.11" | ||
, "description": "CommonJS test runner for Unit Testing/1.1" | ||
, "homepage": "http://github.com/Gozala/test-commonjs/" | ||
, "author": "Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)" | ||
, "contributors": | ||
[ "Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)" | ||
, "Kris Kowal <kris@cixar.com> (http://github.com/kriskowal/)" | ||
, "Zach Carter" | ||
, "Felix Geisendörfer" | ||
, "Karl Guertin" | ||
, "Ash Berlin" | ||
] | ||
, "repository": | ||
{ "type": "git" | ||
, "url": "git://github.com/Gozala/test-commonjs.git" | ||
} | ||
, "bugs": { "web": "http://github.com/Gozala/test-commonjs/issues/" } | ||
, "directories": | ||
{ "doc": "./doc" | ||
, "man": "./man" | ||
, "lib": "./lib" | ||
, "test": "./test" | ||
} | ||
, "scripts": { "test": "node test/all.js" } | ||
, "main": "./lib/test" | ||
, "engines": { "node": ">=0.1.103" } | ||
, "licenses" : | ||
[ { "type" : "MPL 1.1/LGPL 2.1/GPL 2.0" | ||
, "url" : "http://www.mozilla.org/MPL/" | ||
{ "name": "test", | ||
"version": "0.1.0", | ||
"description": "CommonJS test runner for Unit Testing/1.1", | ||
"homepage": "http://github.com/Gozala/test-commonjs/", | ||
"author": "Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)", | ||
"contributors": [ | ||
"Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)", | ||
"Kris Kowal <kris@cixar.com> (http://github.com/kriskowal/)", | ||
"Zach Carter", | ||
"Felix Geisendörfer", | ||
"Karl Guertin", | ||
"Ash Berlin" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/Gozala/test-commonjs.git" | ||
}, | ||
"bugs": { "web": "http://github.com/Gozala/test-commonjs/issues/" }, | ||
"directories": { | ||
"doc": "./doc", | ||
"man": "./man", | ||
"lib": "./lib", | ||
"test": "./test" | ||
}, | ||
"overlay": { | ||
"node": { "directories": { "lib": "./engines/node" } } | ||
}, | ||
"scripts": { "test": "node test/all.js" }, | ||
"main": "./engines/common/test", | ||
"engines": { "node": ">=0.1.103" }, | ||
"licenses": [ | ||
{ | ||
"type" : "MPL 1.1/LGPL 2.1/GPL 2.0", | ||
"url" : "http://www.mozilla.org/MPL/" | ||
} | ||
] | ||
} |
@@ -25,12 +25,7 @@ CommonJS Test Runner | ||
{ "name": "mypackage" | ||
, "version": "0.7.0" | ||
, "description": "Sample package" | ||
, "directories": | ||
{ "lib": "./lib" | ||
, "test": "./test" | ||
} | ||
, "scripts": { "test": "node test/all.js" } | ||
, "engines": { "node": ">=0.1.103" } | ||
, "dependencies": { "test": ">=0.0.5" } | ||
{ "name": "mypackage", | ||
"version": "0.7.0", | ||
"description": "Sample package", | ||
"scripts": { "test": "node test/all.js" }, | ||
"dependencies": { "test": ">=0.0.5" } | ||
} | ||
@@ -84,11 +79,11 @@ | ||
var AssertBase = require('assert').Assert | ||
var AssertDescriptor = | ||
{ constructor: { value: Assert } | ||
, inRange: { value: function (lower, inner, upper, message) { | ||
var AssertDescriptor = { | ||
constructor: { value: Assert }, | ||
inRange: { value: function (lower, inner, upper, message) { | ||
if (lower < inner && inner < upper) { | ||
this.fail( | ||
{ actual: inner, | ||
, expected: lower + '> ' + ' < ' + upper | ||
, operator: "inRange" | ||
, message: message | ||
this.fail({ | ||
actual: inner, | ||
expected: lower + '> ' + ' < ' + upper, | ||
operator: "inRange", | ||
message: message | ||
}) | ||
@@ -101,6 +96,3 @@ } else { | ||
function Assert() { | ||
return Object.create | ||
( AssertBase.apply(null, arguments) | ||
, AssertDescriptor | ||
) | ||
return Object.create(AssertBase.apply(null, arguments), AssertDescriptor) | ||
} | ||
@@ -107,0 +99,0 @@ |
@@ -7,88 +7,69 @@ 'use strict' | ||
exports['test must call callback to complete it'] = function(assert, done) { | ||
var isDone = false | ||
, isTimerCalled = false | ||
, report = null | ||
, completeInnerTest | ||
run( | ||
{ mute: true | ||
, Assert: Reporter | ||
, 'test:must throw': function($assert, $done) { | ||
report = $assert.report | ||
completeInnerTest = $done | ||
$assert.equal(1, 1, 'Must be equal') | ||
} | ||
var isDone, isTimerCalled, report, completeInnerTest | ||
isDone = isTimerCalled = false | ||
report = null | ||
run({ | ||
mute: true, | ||
Assert: Reporter, | ||
'test:must throw': function($assert, $done) { | ||
report = $assert.report | ||
completeInnerTest = $done | ||
$assert.equal(1, 1, 'Must be equal') | ||
} | ||
, function(result) { | ||
isDone = true | ||
assert.equal(isTimerCalled, true, 'timer should be called already') | ||
done() | ||
} | ||
) | ||
}, function(result) { | ||
isDone = true | ||
assert.equal(isTimerCalled, true, 'timer should be called already') | ||
done() | ||
}) | ||
setTimeout(function() { | ||
assert.equal(isDone, false, 'callback must not be called') | ||
assert.equal | ||
( report.passes.length | ||
, 1 | ||
, 'Must contain one pass' | ||
) | ||
assert.equal(report.passes.length, 1, 'Must contain one pass') | ||
isTimerCalled = true | ||
completeInnerTest() | ||
}) | ||
}, 0) | ||
} | ||
exports['test multiple tests with timeout'] = function(assert, done) { | ||
var reports = [] | ||
run( | ||
{ mute: true | ||
, 'test async': function($, done) { | ||
reports.push(1) | ||
setTimeout(function() { | ||
$.ok(true) | ||
$.ok(false) | ||
done() | ||
}) | ||
} | ||
, 'test throws': function($) { | ||
reports.push(2) | ||
throw new Error('boom') | ||
} | ||
, 'test fail fast': function($) { | ||
reports.push(3) | ||
require('assert').ok(0) | ||
} | ||
, 'ignore if does not starts with test': function() { | ||
reports.push(5) | ||
} | ||
, 'test sync pass': function($) { | ||
reports.push(4) | ||
$.equal(1, 2) | ||
$.equal(2, 2) | ||
} | ||
var reports | ||
reports = [] | ||
run({ | ||
mute: true, | ||
'test async': function($, done) { | ||
reports.push(1) | ||
setTimeout(function() { | ||
$.ok(true) | ||
$.ok(false) | ||
done() | ||
}, 100) | ||
}, | ||
'test throws': function($) { | ||
reports.push(2) | ||
throw new Error('boom') | ||
}, | ||
'test fail fast': function($) { | ||
reports.push(3) | ||
require('assert').ok(0) | ||
}, | ||
'ignore if does not starts with test': function() { | ||
reports.push(5) | ||
}, | ||
'test sync pass': function($) { | ||
reports.push(4) | ||
$.equal(1, 2) | ||
$.equal(2, 2) | ||
} | ||
, function(result) { | ||
assert.equal | ||
( reports.length | ||
, 4 | ||
, 'Suite had to contain three tests' | ||
) | ||
assert.equal | ||
( result.passes.length | ||
, 2 | ||
, 'Must pass two tests' | ||
) | ||
assert.equal | ||
( result.fails.length | ||
, 3 | ||
, 'Must fail tree tests' | ||
) | ||
assert.equal | ||
( result.errors.length | ||
, 1 | ||
, 'Must report one error' | ||
) | ||
done() | ||
} | ||
) | ||
}, function(result) { | ||
assert.equal(reports.length, 4, 'Suite had to contain three tests') | ||
assert.equal(result.passes.length, 2, 'Must pass two tests') | ||
assert.equal(result.fails.length, 3, 'Must fail tree tests') | ||
assert.equal(result.errors.length, 1, 'Must report one error') | ||
done() | ||
}) | ||
} | ||
if (module == require.main) run(exports) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 3 instances in 1 package
1
38347
15
1140
114