Skip to content

Commit

Permalink
Remove PhantomJS specfic conditional
Browse files Browse the repository at this point in the history
We're not testing in PhantomJS anymore
  • Loading branch information
mroderick committed Oct 8, 2018
1 parent 2080ec2 commit 7b0826b
Showing 1 changed file with 28 additions and 33 deletions.
61 changes: 28 additions & 33 deletions test/util/core/wrap-method-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,44 +162,39 @@ describe("util/core/wrapMethod", function () {
}
});

var overridingErrorAndTypeError = (function () {
return !(typeof navigator === "object" && /PhantomJS/.test(navigator.userAgent));
}());
if (overridingErrorAndTypeError) {
describe("originating stack traces", function () {
beforeEach(function () {
this.oldError = Error;
this.oldTypeError = TypeError;

var i = 0;

Error = TypeError = function () { // eslint-disable-line no-native-reassign, no-undef
this.stack = ":STACK" + ++i + ":";
};
});
describe("originating stack traces", function () {
beforeEach(function () {
this.oldError = Error;
this.oldTypeError = TypeError;

afterEach(function () {
Error = this.oldError; // eslint-disable-line no-native-reassign, no-undef
TypeError = this.oldTypeError; // eslint-disable-line no-native-reassign, no-undef
});
var i = 0;

it("throws with stack trace showing original wrapMethod call", function () {
var object = { method: function () {} };
wrapMethod(object, "method", function () {
return "original";
});
Error = TypeError = function () { // eslint-disable-line no-native-reassign, no-undef
this.stack = ":STACK" + ++i + ":";
};
});

assert.exception(
function () {
wrapMethod(object, "method", function () {});
},
{
stack: ":STACK2:\n--------------\n:STACK1:"
}
);
afterEach(function () {
Error = this.oldError; // eslint-disable-line no-native-reassign, no-undef
TypeError = this.oldTypeError; // eslint-disable-line no-native-reassign, no-undef
});

it("throws with stack trace showing original wrapMethod call", function () {
var object = { method: function () {} };
wrapMethod(object, "method", function () {
return "original";
});

assert.exception(
function () {
wrapMethod(object, "method", function () {});
},
{
stack: ":STACK2:\n--------------\n:STACK1:"
}
);
});
}
});

if (typeof window !== "undefined") {
describe("in browser", function () {
Expand Down

0 comments on commit 7b0826b

Please sign in to comment.