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

Add fakeTimersLolex to implement JestEnvironment interface #44033

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions types/jest-environment-puppeteer/index.d.ts
@@ -1,4 +1,4 @@
// Type definitions for jest-environment-puppeteer 4.3
// Type definitions for jest-environment-puppeteer 4.4
// Project: https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-environment-puppeteer
// Definitions by: Josh Goldberg <https://github.com/joshuakgoldberg>
// Ifiok Jr. <https://github.com/ifiokjr>
Expand All @@ -7,7 +7,7 @@
// TypeScript Version: 3.4

import { JestEnvironment } from '@jest/environment';
import { JestFakeTimers as FakeTimers } from '@jest/fake-timers';
import { JestFakeTimers as FakeTimers, LolexFakeTimers } from '@jest/fake-timers';
import { Circus, Global as GlobalType, Config } from '@jest/types';
import { ModuleMocker } from 'jest-mock';
import { Browser, Page, BrowserContext } from 'puppeteer';
Expand Down Expand Up @@ -67,6 +67,7 @@ interface Global extends GlobalType.Global {
declare class PuppeteerEnvironment implements JestEnvironment {
context: Context | null;
fakeTimers: FakeTimers<Timer> | null;
fakeTimersLolex: LolexFakeTimers | null;
global: Global;
moduleMocker: ModuleMocker | null;
constructor(config: Config.ProjectConfig);
Expand Down
Expand Up @@ -40,3 +40,4 @@ class CustomJestEnvironment extends JestEnvironmentPuppeteer {
type JestEnvironmentPuppeteerGlobal = JestEnvironmentPuppeteer['global']; // $ExpectType Global
type JestEnvironmentPuppeteerGlobalPuppeteer = JestEnvironmentPuppeteer['global']['jestPuppeteer']; // $ExpectType JestPuppeteer
type JestEnvironmentPuppeteerFakeTimers = JestEnvironmentPuppeteer['fakeTimers']; // $ExpectType FakeTimers<Timer> | null
type JestEnvironmentPuppeteerFakeTimersLolex = JestEnvironmentPuppeteer['fakeTimersLolex']; // $ExpectType LolexFakeTimers | null