Comparing version 0.0.16 to 0.0.17
69
index.js
@@ -33,6 +33,7 @@ 'use strict'; | ||
var parameters = processParameters(arguments); | ||
var message = parameters.message || true; | ||
if (parameters.callback) | ||
message = parameters.message || true; | ||
callback = parameters.callback; | ||
if (callback) | ||
{ | ||
return parameters.callback(null, message); | ||
return callback(null, message); | ||
} | ||
@@ -48,3 +49,3 @@ if (errors) | ||
} | ||
} | ||
}; | ||
@@ -62,9 +63,10 @@ /** | ||
var parameters = processParameters(arguments); | ||
var message = parameters.message || 'Failure'; | ||
if (parameters.callback) | ||
message = parameters.message || 'Failure'; | ||
callback = parameters.callback; | ||
if (callback) | ||
{ | ||
return parameters.callback(message); | ||
return callback(message); | ||
} | ||
log.error(IN_RED, message); | ||
} | ||
}; | ||
@@ -122,10 +124,11 @@ /** | ||
var parameters = processParameters(arguments); | ||
var message = parameters.message || 'Assertion error'; | ||
if (parameters.callback) | ||
message = parameters.message || 'Assertion error'; | ||
callback = parameters.callback; | ||
if (callback) | ||
{ | ||
return parameters.callback(parameters.message); | ||
return callback(parameters.message); | ||
} | ||
// show failure with the given arguments | ||
exports.failure(parameters.message); | ||
} | ||
}; | ||
@@ -149,10 +152,11 @@ /** | ||
var parameters = processParameters(arguments); | ||
var message = parameters.message || 'Assertion for equality error'; | ||
var message = util.format('%s: expected %s but got %s', message, util.inspect(expected), util.inspect(actual)); | ||
if (parameters.callback) | ||
message = parameters.message || 'Assertion for equality error'; | ||
message = util.format('%s: expected %s but got %s', message, util.inspect(expected), util.inspect(actual)); | ||
callback = parameters.callback; | ||
if (callback) | ||
{ | ||
return parameters.callback(message); | ||
return callback(message); | ||
} | ||
exports.failure(message); | ||
} | ||
}; | ||
@@ -175,10 +179,11 @@ /** | ||
var parameters = processParameters(arguments); | ||
var message = parameters.message || 'Assertion for inequality error'; | ||
var message = util.format('%s: expected %s different from %s', message, util.inspect(actual), util.inspect(unexpected)); | ||
if (parameters.callback) | ||
message = parameters.message || 'Assertion for inequality error'; | ||
message = util.format('%s: expected %s different from %s', message, util.inspect(actual), util.inspect(unexpected)); | ||
callback = parameters.callback; | ||
if (callback) | ||
{ | ||
return parameters.callback(message); | ||
return callback(message); | ||
} | ||
exports.failure(message); | ||
} | ||
}; | ||
@@ -196,10 +201,11 @@ /** | ||
var parameters = processParameters(arguments); | ||
var message = parameters.message + ': ' + util.inspect(error); | ||
if (parameters.callback) | ||
message = parameters.message + ': ' + util.inspect(error); | ||
callback = parameters.callback; | ||
if (callback) | ||
{ | ||
return parameters.callback(message); | ||
return callback(message); | ||
} | ||
// show failure with the given arguments | ||
exports.failure(message); | ||
} | ||
}; | ||
@@ -240,3 +246,6 @@ /** | ||
{ | ||
nTests += 1; | ||
if (tests.hasOwnProperty(key)) | ||
{ | ||
nTests += 1; | ||
} | ||
} | ||
@@ -264,3 +273,3 @@ // if no timeout, give each test one second | ||
}); | ||
} | ||
}; | ||
@@ -285,3 +294,3 @@ /** | ||
} | ||
} | ||
}; | ||
@@ -316,3 +325,3 @@ /** | ||
exports.run(tests, callback); | ||
} | ||
}; | ||
@@ -319,0 +328,0 @@ // run tests if invoked directly |
@@ -11,3 +11,2 @@ 'use strict'; | ||
var Log = require('log'); | ||
var util = require('util'); | ||
@@ -69,3 +68,3 @@ // globals | ||
} | ||
} | ||
}; | ||
@@ -115,4 +114,4 @@ /** | ||
return getPrintable(self, message, indent); | ||
} | ||
} | ||
}; | ||
}; | ||
@@ -149,3 +148,3 @@ /** | ||
} | ||
} | ||
}; | ||
@@ -166,5 +165,5 @@ /** | ||
message += getIndented(indent) + '}'; | ||
return message | ||
} | ||
} | ||
return message; | ||
}; | ||
}; | ||
@@ -236,3 +235,3 @@ /** | ||
}); | ||
} | ||
}; | ||
@@ -277,3 +276,3 @@ /** | ||
}); | ||
} | ||
}; | ||
@@ -295,3 +294,3 @@ /** | ||
var runner = new Runner(key, value); | ||
runner.runAll(function(error, result) | ||
runner.runAll(function(error) | ||
{ | ||
@@ -355,3 +354,3 @@ if (error) | ||
} | ||
} | ||
}; | ||
@@ -374,3 +373,3 @@ /** | ||
}, | ||
f: function(callback) { | ||
f: function() { | ||
throw new Error('exception'); | ||
@@ -430,5 +429,5 @@ }, | ||
var original = { | ||
a: function(parameter) {}, | ||
a: function() {}, | ||
b: { | ||
c: function(parameter) {}, | ||
c: function() {}, | ||
}, | ||
@@ -435,0 +434,0 @@ }; |
{ | ||
"name": "testing", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Simple asynchronous testing framework. Never again count your asserts! This tiny testing library is fully callback-based and has a rich API for asserts.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/alexfernandez/testing", |
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
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
24696
8
739