UNPKG

1.4 kBTypeScriptView Raw
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
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" />
8
9import type {Context} from 'vm';
10import type {EnvironmentContext} from '@jest/environment';
11import type {Global} from '@jest/types';
12import type {JestEnvironment} from '@jest/environment';
13import type {JestEnvironmentConfig} from '@jest/environment';
14import {JSDOM} from 'jsdom';
15import {LegacyFakeTimers} from '@jest/fake-timers';
16import {ModernFakeTimers} from '@jest/fake-timers';
17import {ModuleMocker} from 'jest-mock';
18
19declare class JSDOMEnvironment implements JestEnvironment<number> {
20 dom: JSDOM | null;
21 fakeTimers: LegacyFakeTimers<number> | null;
22 fakeTimersModern: ModernFakeTimers | null;
23 global: Win;
24 private errorEventListener;
25 moduleMocker: ModuleMocker | null;
26 customExportConditions: string[];
27 private _configuredExportConditions?;
28 constructor(config: JestEnvironmentConfig, context: EnvironmentContext);
29 setup(): Promise<void>;
30 teardown(): Promise<void>;
31 exportConditions(): Array<string>;
32 getVmContext(): Context | null;
33}
34export default JSDOMEnvironment;
35
36export declare const TestEnvironment: typeof JSDOMEnvironment;
37
38declare type Win = Window &
39 Global.Global & {
40 Error: {
41 stackTraceLimit: number;
42 };
43 };
44
45export {};