Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Commit

Permalink
Handle arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-roemer committed Feb 28, 2015
1 parent 2c4b989 commit de8b450
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 33 deletions.
58 changes: 30 additions & 28 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,39 +82,40 @@ var SAUCE_ENVS = {
// base: "SauceLabs",
// browserName: "firefox"
// },
sl_chrome: {
base: "SauceLabs",
browserName: "chrome"
},
// sl_chrome: {
// base: "SauceLabs",
// browserName: "chrome"
// },
sl_safari: {
base: "SauceLabs",
browserName: "safari",
platform: "OS X 10.9"
},
sl_ie_8: {
base: "SauceLabs",
browserName: "internet explorer",
platform: "Windows XP",
version: "8"
},
sl_ie_9: {
base: "SauceLabs",
browserName: "internet explorer",
platform: "Windows 7",
version: "9"
},
sl_ie_10: {
base: "SauceLabs",
browserName: "internet explorer",
platform: "Windows 7",
version: "10"
},
sl_ie_11: {
base: "SauceLabs",
browserName: "internet explorer",
platform: "Windows 7",
version: "11"
}
// },
// sl_ie_8: {
// base: "SauceLabs",
// browserName: "internet explorer",
// platform: "Windows XP",
// version: "8"
// },
// sl_ie_9: {
// base: "SauceLabs",
// browserName: "internet explorer",
// platform: "Windows 7",
// version: "9"
// },
// sl_ie_10: {
// base: "SauceLabs",
// browserName: "internet explorer",
// platform: "Windows 7",
// version: "10"
// },
// sl_ie_11: {
// base: "SauceLabs",
// browserName: "internet explorer",
// platform: "Windows 7",
// version: "11"
// }
/*eslint-enable camelcase*/
};

Expand Down Expand Up @@ -157,6 +158,7 @@ var testFrontend = function () {
port: 9999,
reporters: ["spec"],
client: {
captureConsole: true,
mocha: {
ui: "bdd"
}
Expand Down
19 changes: 14 additions & 5 deletions simple-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
",warn"
).split(",");

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/
// Global_Objects/Array/isArray
var isArray = Array.isArray || function (arg) {
return Object.prototype.toString.call(arg) === "[object Array]";
};

/**
* Console abstraction.
*/
Expand All @@ -44,15 +50,18 @@
if (noConsole || !con[meth]) {
// No console or method: Noop it.
self[meth] = NOOP;
} else if (con[meth].bind) {
// Try to use built-in bind first, where possible.
// (Hopefully) fixes Safari on Mac OS X 10.9 on Sauce.
} else if (isArray(con[meth])) {
// Straight assign any array objects.
// *Note*: Could do `.slice(0);` to clone.
//
// Fixes Safari on Mac OS X 10.9 on Sauce.
// Issue is `console.profiles`, which is an array.
// See: https://saucelabs.com/tests/9a89e381c91c4e43b25ab8ee16a514e1
self[meth] = con[meth].bind(con);
self[meth] = con[meth];
} else if (bind) {
// IE9 and most others: Bind to our create real function.
// Should work if `console.FOO` is `function` or `object`.
self[meth] = bind(con[meth], con);
self[meth] = bind.call(con[meth], con);
} else {
// IE8: No bind, so even more tortured.
self[meth] = function () {
Expand Down

0 comments on commit de8b450

Please sign in to comment.