Comparing version 0.1.3 to 0.1.4
@@ -29,3 +29,5 @@ // MiniTest.js | ||
// * Main module | ||
var MiniTest = (function (opts) { | ||
var VERSION = '0.1.4'; | ||
opts = opts || {pollute: false}; | ||
@@ -51,8 +53,10 @@ var global = this; | ||
var message = function (msg, default_msg) { | ||
var str; | ||
return function () { | ||
if (msg !== undefined) { | ||
if (msg === '') msg = msg + '.'; | ||
msg = msg + '\n' + default_msg(); | ||
// yes, i see the backtracking: patches welcome! | ||
return msg.replace( /^\s+(.+)\s+$/, $1); | ||
if (msg !== '') | ||
msg = msg + '.'; | ||
msg = msg + "\n" + default_msg(); | ||
str = msg.replace(/^\s*/, ''); | ||
return str.replace(/\s*$/, ''); | ||
} else { | ||
@@ -83,3 +87,6 @@ return default_msg() + '.'; | ||
} | ||
throw new Failure(msg); | ||
var f = new Failure(); | ||
f.message = msg; | ||
throw f; | ||
} | ||
@@ -399,3 +406,5 @@ return true; | ||
for (prop in tc) { | ||
//console.log(prop); | ||
if (prop.match(/^test/) && typeof tc[prop] === 'function') { | ||
tc[prop].__name__ = prop; | ||
tests.push(tc[prop]); | ||
@@ -420,2 +429,3 @@ } | ||
} catch (e) { | ||
e.test = tests[i]; | ||
if (e instanceof Failure) { | ||
@@ -432,7 +442,13 @@ failures.push(e); | ||
if (process !== undefined) | ||
process.stdout.write("\n"); | ||
output.log(); | ||
if (failures.length > 0) { | ||
output.log("Failures:"); | ||
for (fail in failures) { | ||
output.log(fail.name + ": " + fail.message); | ||
for (var i = 0; i < failures.length; i++) { | ||
output.log(failures[i].test.__name__ + ": " + failures[i].message); | ||
} | ||
output.log(); | ||
} | ||
@@ -442,5 +458,6 @@ | ||
output.log("Errors:"); | ||
for (error in errors) { | ||
output.log(error.name + ": " + error.message); | ||
for (var i = 0; i < errors.length; i++) { | ||
output.link(errors[i].type + ": " + errors[i].message); | ||
} | ||
output.log(); | ||
} | ||
@@ -447,0 +464,0 @@ |
{ | ||
"name": "minitest", | ||
"description": "A port of Ruby's MiniTest::Unit", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"url": "https://github.com/deanh/minitest.js", | ||
@@ -6,0 +6,0 @@ "author": "H. Dean Hudson <dean@ero.com>", |
@@ -30,6 +30,7 @@ # minitest.js # | ||
Starting tests... | ||
. | ||
. | ||
.. | ||
Failures: | ||
undefined: undefined | ||
testNoMeansNo: 0 + 2 = 1? | ||
2 tests, 2 assertions, 1 failures, 0 errors. | ||
@@ -36,0 +37,0 @@ Run time: 2ms |
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
20606
5
446
50