Skip to content
Browse files

Fallback to sys if util doesn't exist

  • Loading branch information...
1 parent 1ba3317 commit 169dcf325dad3ee7ddd438146a65f7a57e1b06d7 Benjamin Thomas committed
Showing with 18 additions and 19 deletions.
  1. +9 −10 lib/testing.js
  2. +8 −1 lib/web-runner.js
  3. +1 −8 test/flow/flow-wrap.js
View
19 lib/testing.js
@@ -2,18 +2,9 @@ var assert = require('assert')
, path = require('path')
, fs = require('fs')
, spawn = require('child_process').spawn
- , util = require('util')
;
-var TestAlreadyFinishedError = function(message) {
- this.name = "TestAlreadyFinishedError";
- this.message = message;
- Error.captureStackTrace(this);
-};
-util.inherits(assert.AssertionError, Error);
-TestAlreadyFinishedError.__proto__ = Error.prototype;
-
-/* Runs an object of tests. Each property in the object should be a
+/* Runs an object with tests. Each property in the object should be a
* test. A test is just a method.
*
* Available configuration options:
@@ -547,3 +538,11 @@ exports.messageEncode = function() {
return r;
}
+
+var TestAlreadyFinishedError = function(message) {
+ this.name = "TestAlreadyFinishedError";
+ this.message = message;
+ Error.captureStackTrace(this);
+};
+TestAlreadyFinishedError.__proto__ = Error.prototype;
+
View
9 lib/web-runner.js
@@ -1,5 +1,4 @@
var http = require('http')
- , util = require('util')
, path = require('path')
, fs = require('fs')
, testing = require('./testing')
@@ -7,6 +6,14 @@ var http = require('http')
, io
;
+try {
+ var util = require('util');
+}
+catch(err) {
+ if( err.message == "Cannot find module 'util'" ) {
@dbrock
dbrock added a note

Here is the unmatched brace that currently prevents the package from loading. (See Issue #3.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ var util = require('sys');
+}
+
exports.name = 'Web';
exports.runnerFlag =
View
9 test/flow/flow-wrap.js
@@ -251,15 +251,8 @@ function convert(obj, p, prefix) {
}
module.exports = convert(tests, '__');
-//console.log(require('util').inspect(module.exports, null, 3));
setTimeout(function() {
- var len = 0;
- // get around weird bugs in node where I can't print large strings
- while (len < order.length) {
- require('util').print(order.substr(len, 200));
- len += 200;
- }
- console.log('');
+ console.log(order);
}, 2200);

0 comments on commit 169dcf3

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