UNPKG

1.19 kBTypeScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7/// <reference types="node" />
8import type { Context } from 'vm';
9import { JSDOM } from 'jsdom';
10import type { EnvironmentContext, JestEnvironment } from '@jest/environment';
11import { LegacyFakeTimers, ModernFakeTimers } from '@jest/fake-timers';
12import type { Config, Global } from '@jest/types';
13import { ModuleMocker } from 'jest-mock';
14declare type Win = Window & Global.Global & {
15 Error: {
16 stackTraceLimit: number;
17 };
18};
19declare class JSDOMEnvironment implements JestEnvironment<number> {
20 dom: JSDOM | null;
21 fakeTimers: LegacyFakeTimers<number> | null;
22 fakeTimersModern: ModernFakeTimers | null;
23 global: Win;
24 errorEventListener: ((event: Event & {
25 error: Error;
26 }) => void) | null;
27 moduleMocker: ModuleMocker | null;
28 constructor(config: Config.ProjectConfig, options?: EnvironmentContext);
29 setup(): Promise<void>;
30 teardown(): Promise<void>;
31 getVmContext(): Context | null;
32}
33export = JSDOMEnvironment;