Comparing version 0.4.0 to 0.5.0
@@ -21,8 +21,4 @@ #!/usr/bin/env node | ||
+ '\n -d, --deps dependency paths - files required before code (space separated)' | ||
+ '\n -o, --errors-only report only errors' | ||
+ '\n -e, --error-stack display error stack' | ||
+ '\n -s, --summary display summary report' | ||
+ '\n -l, --log logging options, json have to be used' | ||
+ '\n --cov create tests coverage report' | ||
+ '\n -p, --paths, add paths to require.paths array' | ||
+ '\n --tmp change temp dir, which is used for jscoverage tool' | ||
+ '\n -h, --help show this help' | ||
@@ -76,3 +72,3 @@ + '\n -v, --version show module version' | ||
o.deps = args[key]; | ||
if (!Array.isArray (o.deps)) { | ||
if (!Array.isArray(o.deps)) { | ||
o.deps = [o.deps]; | ||
@@ -82,14 +78,6 @@ } | ||
break; | ||
case '-o': | ||
case '--errors-only': | ||
o.errorsOnly = args[key]; | ||
case '-l': | ||
case '--log': | ||
eval('o.log = ' + args[key]); | ||
break; | ||
case '-e': | ||
case '--error-stack': | ||
o.errorStack = args[key]; | ||
break; | ||
case '-s': | ||
case '--summary': | ||
o.summary = args[key]; | ||
break; | ||
case '--cov': | ||
@@ -102,5 +90,2 @@ o.coverage = args[key]; | ||
break; | ||
case '--tmp': | ||
o.coverageTmpDir = args[key]; | ||
break; | ||
case '-v': | ||
@@ -107,0 +92,0 @@ case '--version': |
@@ -72,3 +72,3 @@ var Table = require('cli-table'); | ||
var print = {}; | ||
var print = exports.print = {}; | ||
@@ -103,3 +103,3 @@ print.assertions = function() { | ||
log('Assertions:\n' + table.toString()); | ||
log('\nAssertions:\n' + table.toString()); | ||
}; | ||
@@ -148,3 +148,3 @@ | ||
log('\Tests:\n' + table.toString()); | ||
log('\nTests:\n' + table.toString()); | ||
}; | ||
@@ -171,3 +171,3 @@ | ||
log('\Summary:\n' + table.toString()); | ||
log('\nSummary:\n' + table.toString()); | ||
}; | ||
@@ -187,16 +187,3 @@ | ||
log('\Global summary:\n' + table.toString()); | ||
log('\nGlobal summary:\n' + table.toString()); | ||
}; | ||
/** | ||
* Print stats table to the stdout | ||
* @param {String} name of the table. | ||
* @api public | ||
*/ | ||
exports.print = function(name) { | ||
if (print[name]) { | ||
print[name](); | ||
} else { | ||
throw new Error('bad stats name: ' + name ); | ||
} | ||
}; |
@@ -6,3 +6,4 @@ var fs = require('fs'), | ||
_ = require('underscore'), | ||
log = exports.log = require('./log'); | ||
log = exports.log = require('./log'), | ||
util = require('util'); | ||
@@ -31,2 +32,4 @@ var options; | ||
// log currently testing code file | ||
testing: true | ||
}, | ||
@@ -66,8 +69,13 @@ | ||
log.summary(msg.data); | ||
if (opts.log.testing) { | ||
util.print('done'); | ||
} | ||
callback(msg.data); | ||
child.kill(); | ||
} | ||
}); | ||
if (opts.log.testing) { | ||
util.print('\nTesting ', opts.code.path + ' ... '); | ||
} | ||
} | ||
@@ -135,4 +143,4 @@ | ||
_.each(opts.log, function(val, name) { | ||
if (val) { | ||
log.print(name); | ||
if (val && log.print[name]) { | ||
log.print[name](); | ||
} | ||
@@ -154,1 +162,10 @@ }) | ||
}; | ||
/** | ||
* Set options | ||
* @param {Object} | ||
*/ | ||
exports.setup = function(opts) { | ||
_.extend(options, opts); | ||
}; |
{ | ||
"name": "qunit", | ||
"description": "A port of QUnit unit testing framework to nodejs", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"author": "Oleg Slobodskoi <oleg008@gmail.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -59,7 +59,16 @@ ## This is a port of QUnit unit testing framework to nodejs | ||
// A comparison assertion, equivalent to JUnit's assertEquals. Uses "==". | ||
notEqual(actual, expected, message) | ||
// A deep recursive comparison assertion, working on primitive types, arrays and objects. | ||
deepEqual(actual, expected, message) | ||
// A deep recursive comparison assertion, working on primitive types, arrays and objects, with the result inverted, passing // when some property isn't equal. | ||
notDeepEqual(actual, expected, message) | ||
// A comparison assertion. Uses "===". | ||
strictEqual(actual, expected, message) | ||
// A deep recursive comparison assertion, working on primitive types, arrays and objects. | ||
same(actual, expected, message) | ||
// A stricter comparison assertion then notEqual. Uses "===". | ||
notStrictEqual(actual, expected, message) | ||
@@ -90,3 +99,3 @@ // Assertion to test if a callback throws an exception when run. | ||
$ qunit -c code:./code.js -d utils:utilmodule -r ./time.js | ||
$ qunit -c code:./code.js -d utils:utilmodule -t ./time.js | ||
@@ -101,36 +110,33 @@ ### via api | ||
// logging options | ||
log: { | ||
// log assertions overview | ||
assertions: true, | ||
// log assertions overview | ||
assertions: true, | ||
// log expected and actual values for failed tests | ||
errors: true, | ||
// log expected and actual values for failed tests | ||
errors: true, | ||
// log tests overview | ||
tests: true, | ||
// log tests overview | ||
tests: true, | ||
// log summary | ||
summary: true, | ||
// log summary | ||
summary: true, | ||
// log global summary (all files) | ||
globalSummary: true, | ||
// log global summary (all files) | ||
globalSummary: true, | ||
// log currently testing code file | ||
testing: true | ||
} | ||
}, | ||
// run test coverage tool | ||
coverage: false, | ||
// change any option for all tests globally | ||
testrunner.options.optionName = value; | ||
// define dependencies, which are required then before code | ||
deps: null, | ||
// define namespace your code will be attached to on global['your namespace'] | ||
namespace: null | ||
// or use setup function | ||
testrunner.setup({ | ||
log: { | ||
summary: true | ||
} | ||
}); | ||
// change any option for all tests globally | ||
testrunner.options.optionName = value; | ||
// one code and tests file | ||
@@ -137,0 +143,0 @@ testrunner.run({ |
@@ -11,3 +11,3 @@ var a = require('assert'), | ||
_.extend(tr.options, { | ||
_.extend(tr.options.log, { | ||
assertions: false, | ||
@@ -31,3 +31,3 @@ tests: false, | ||
tests: fixtures + '/testrunner-tests.js', | ||
}, function(res) { | ||
}, function(err, res) { | ||
var stat = { | ||
@@ -50,3 +50,3 @@ files: 1, | ||
tests: fixtures + '/child-tests-global.js', | ||
}, function(res) { | ||
}, function(err, res) { | ||
var stat = { | ||
@@ -73,3 +73,3 @@ files: 1, | ||
tests: fixtures + '/child-tests-namespace.js', | ||
}, function(res) { | ||
}, function(err, res) { | ||
var stat = { | ||
@@ -93,3 +93,3 @@ files: 1, | ||
tests: fixtures + '/async-test.js', | ||
}, function(res) { | ||
}, function(err, res) { | ||
var stat = { | ||
@@ -110,3 +110,3 @@ files: 1, | ||
chain.add(function() { | ||
console.log('All tests done'); | ||
console.log('\nAll tests done'); | ||
}); | ||
@@ -113,0 +113,0 @@ |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
279
193878
4505
2