Skip to content
Browse files

closes #59 dont throw if optional module is not installed, print an e…

…rror if one is trying to use it.
  • Loading branch information...
1 parent ca21cb9 commit 333d890e1f3f061bbb2b5da4c08a724585eed974 @kof committed
Showing with 22 additions and 5 deletions.
  1. +18 −2 lib/coverage.js
  2. +1 −1 lib/testrunner.js
  3. +3 −2 package.json
View
20 lib/coverage.js
@@ -1,5 +1,12 @@
-var bunker = require('bunker'),
- fs = require('fs');
+var fs = require('fs'),
+ util = require('util'),
+ _ = require('underscore'),
+ colors = require('colors'),
+ bunker;
+
+try {
+ bunker = require('bunker');
+} catch (err) {}
exports.instrument = function(path) {
var src = fs.readFileSync(path, 'utf-8'),
@@ -18,3 +25,12 @@ exports.restore = function(path) {
}
};
+
+if (!bunker) {
+ _.each(exports, function(fn, name) {
+ exports[name] = function() {
+ util.error('Module "bunker" is not installed.'.red);
+ process.exit(1);
+ };
+ });
+}
View
2 lib/testrunner.js
@@ -158,7 +158,7 @@ exports.run = function(files, callback) {
}
if (opts.coverage) {
- converage.instrument(opts.code);
+ coverage.instrument(opts.code);
} else {
runOne(opts, finished);
}
View
5 package.json
@@ -1,7 +1,7 @@
{
"name": "qunit",
"description": "QUnit testing framework for nodejs",
- "version": "0.5.9",
+ "version": "0.5.10",
"author": "Oleg Slobodskoi <oleg008@gmail.com>",
"contributors": [
{"name": "Jonathan Buchanan"},
@@ -21,7 +21,8 @@
"underscore": "1.3.3",
"argsparser": "0.0.6",
"cli-table": "0.0.2",
- "tracejs": "0.1.4"
+ "tracejs": "0.1.4",
+ "colors": "0.6.0"
},
"devDependencies": {
"chainer": "0.0.5",

0 comments on commit 333d890

Please sign in to comment.
Something went wrong with that request. Please try again.