From 7f1d9f07d5c5b30913e4f63c2b4e0e3ff867f902 Mon Sep 17 00:00:00 2001 From: Nathan Houle Date: Mon, 16 May 2016 12:01:51 -0700 Subject: [PATCH] Fix missing methods/globals in IE7, IE8 environments --- lib/context.js | 6 ++++++ lib/runnable.js | 1 + lib/utils.js | 4 +++- package.json | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/context.js b/lib/context.js index 4e7247b841..6d82fcadf4 100644 --- a/lib/context.js +++ b/lib/context.js @@ -1,3 +1,9 @@ +/** + * Module dependencies. + */ + +var JSON = require('json3'); + /** * Expose `Context`. */ diff --git a/lib/runnable.js b/lib/runnable.js index 64de4e9a20..037944f498 100644 --- a/lib/runnable.js +++ b/lib/runnable.js @@ -3,6 +3,7 @@ */ var EventEmitter = require('events').EventEmitter; +var JSON = require('json3'); var Pending = require('./pending'); var debug = require('debug')('mocha:runnable'); var milliseconds = require('./ms'); diff --git a/lib/utils.js b/lib/utils.js index 1ec27085fd..70f506ba4b 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -4,6 +4,7 @@ * Module dependencies. */ +var JSON = require('json3'); var basename = require('path').basename; var debug = require('debug')('mocha:watch'); var exists = require('fs').existsSync || require('path').existsSync; @@ -11,6 +12,7 @@ var glob = require('glob'); var join = require('path').join; var readdirSync = require('fs').readdirSync; var statSync = require('fs').statSync; +var toISOString = require('@segment/to-iso-string'); var watchFile = require('fs').watchFile; /** @@ -481,7 +483,7 @@ function jsonStringify(object, spaces, depth) { case 'date': var sDate = isNaN(val.getTime()) // Invalid date ? val.toString() - : val.toISOString(); + : toISOString(val); val = '[Date: ' + sDate + ']'; break; case 'buffer': diff --git a/package.json b/package.json index 49b780cc18..2b1429a47a 100644 --- a/package.json +++ b/package.json @@ -269,6 +269,7 @@ "test": "make test-all" }, "dependencies": { + "@segment/to-iso-string": "0.0.2", "commander": "2.3.0", "debug": "2.2.0", "diff": "1.4.0", @@ -276,6 +277,7 @@ "glob": "3.2.11", "growl": "1.9.2", "jade": "0.26.3", + "json3": "^3.3.2", "mkdirp": "0.5.1", "supports-color": "1.2.0" },