Skip to content

Commit

Permalink
fix: do not modify the Function prototype when running tests
Browse files Browse the repository at this point in the history
refs #2502
  • Loading branch information
fatso83 committed Mar 24, 2023
1 parent 6e19746 commit 3c3dfb2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/stub-test.js
Expand Up @@ -174,6 +174,7 @@ describe("stub", function () {
test: func,
};
func.aProp = 42;

createStub(object, "test");

assert.equals(object.test.aProp, 42);
Expand Down Expand Up @@ -1536,16 +1537,16 @@ describe("stub", function () {
});

it("stubs methods of function", function () {
var func = function () {
return;
};
class FunctionType extends Function {
func2() {
return 42;
}
}

var func = new FunctionType();
func.func1 = function () {
return;
};
// eslint-disable-next-line no-proto
func.__proto__.func2 = function () {
return;
};

createStub(func);

Expand Down

0 comments on commit 3c3dfb2

Please sign in to comment.