Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(testing): correct stub() error message #5575

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion testing/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ export function stub<

const propertyDescriptor = Object.getOwnPropertyDescriptor(self, property);
if (propertyDescriptor && !propertyDescriptor.configurable) {
throw new MockError("Cannot spy on non-configurable instance method");
throw new MockError("Cannot stub non-configurable instance method");
}

const fake = func ?? (() => {}) as (this: Self, ...args: Args) => Return;
Expand Down
2 changes: 1 addition & 1 deletion testing/mock_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ Deno.test("stub() throws then the property is not configurable", () => {
assertThrows(
() => stub(obj, "fn"),
MockError,
"Cannot spy on non-configurable instance method",
"Cannot stub non-configurable instance method",
);
});

Expand Down