Skip to content

Commit

Permalink
fix(runtime): handle missing mocked property
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Jan 4, 2022
1 parent 4eabd9d commit 79fdfdb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/jest-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,13 @@ export default class Runtime {
};
const fn = this._moduleMocker.fn.bind(this._moduleMocker);
const spyOn = this._moduleMocker.spyOn.bind(this._moduleMocker);
const mocked = this._moduleMocker.mocked.bind(this._moduleMocker);
const mocked =
this._moduleMocker.mocked?.bind(this._moduleMocker) ??
(() => {
throw new Error(
'Your test environment does not support `mocked`, please update it',
);
});

const setTimeout = (timeout: number) => {
if (this._environment.global.jasmine) {
Expand Down

0 comments on commit 79fdfdb

Please sign in to comment.