Skip to content

Commit

Permalink
eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
k-rajat19 committed Dec 8, 2021
1 parent 3094fdf commit 55c9faa
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions packages/jest-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1943,35 +1943,40 @@ export default class Runtime {
};

const jestObject: Jest = {
advanceTimersByTime: (msToRun: number) => _getFakeTimers().advanceTimersByTime(msToRun),
advanceTimersToNextTimer: (steps?: number) => _getFakeTimers().advanceTimersToNextTimer(steps),
advanceTimersByTime: (msToRun: number) =>
_getFakeTimers().advanceTimersByTime(msToRun),
advanceTimersToNextTimer: (steps?: number) =>
_getFakeTimers().advanceTimersToNextTimer(steps),
autoMockOff: disableAutomock,
autoMockOn: enableAutomock,
clearAllMocks,
clearAllTimers: () => _getFakeTimers().clearAllTimers(),
createMockFromModule: (moduleName: string) => this._generateMock(from, moduleName),
createMockFromModule: (moduleName: string) =>
this._generateMock(from, moduleName),
deepUnmock,
disableAutomock,
doMock: mock,
dontMock: unmock,
enableAutomock,
fn,
genMockFromModule: (moduleName: string) => this._generateMock(from, moduleName),
genMockFromModule: (moduleName: string) =>
this._generateMock(from, moduleName),
getRealSystemTime: () => {
const fakeTimers = _getFakeTimers();

if (fakeTimers === this._environment.fakeTimersModern) {
return fakeTimers.getRealSystemTime();
} else {
throw new TypeError(
'getRealSystemTime is not available when not using modern timers'
'getRealSystemTime is not available when not using modern timers',
);
}
},
getTimerCount: () => _getFakeTimers().getTimerCount(),
isMockFunction: this._moduleMocker.isMockFunction,
isolateModules,
mock,
mocked,
requireActual: this.requireActual.bind(this, from),
requireMock: this.requireMock.bind(this, from),
resetAllMocks,
Expand All @@ -1985,22 +1990,23 @@ export default class Runtime {
fakeTimers.runAllImmediates();
} else {
throw new TypeError(
'runAllImmediates is not available when using modern timers'
'runAllImmediates is not available when using modern timers',
);
}
},
runAllTicks: () => _getFakeTimers().runAllTicks(),
runAllTimers: () => _getFakeTimers().runAllTimers(),
runOnlyPendingTimers: () => _getFakeTimers().runOnlyPendingTimers(),
setMock: (moduleName: string, mock: unknown) => setMockFactory(moduleName, () => mock),
setMock: (moduleName: string, mock: unknown) =>
setMockFactory(moduleName, () => mock),
setSystemTime: (now?: number | Date) => {
const fakeTimers = _getFakeTimers();

if (fakeTimers === this._environment.fakeTimersModern) {
fakeTimers.setSystemTime(now);
} else {
throw new TypeError(
'setSystemTime is not available when not using modern timers'
'setSystemTime is not available when not using modern timers',
);
}
},
Expand All @@ -2010,7 +2016,6 @@ export default class Runtime {
unstable_mockModule: mockModule,
useFakeTimers,
useRealTimers,
mocked,
};
return jestObject;
}
Expand Down

0 comments on commit 55c9faa

Please sign in to comment.