UNPKG

1.33 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 {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 {LegacyFakeTimers} from '@jest/fake-timers';
15import {ModernFakeTimers} from '@jest/fake-timers';
16import {ModuleMocker} from 'jest-mock';
17
18declare class NodeEnvironment implements JestEnvironment<Timer> {
19 context: Context | null;
20 fakeTimers: LegacyFakeTimers<Timer> | null;
21 fakeTimersModern: ModernFakeTimers | null;
22 global: Global.Global;
23 moduleMocker: ModuleMocker | null;
24 customExportConditions: string[];
25 private _configuredExportConditions?;
26 constructor(config: JestEnvironmentConfig, _context: EnvironmentContext);
27 setup(): Promise<void>;
28 teardown(): Promise<void>;
29 exportConditions(): Array<string>;
30 getVmContext(): Context | null;
31}
32export default NodeEnvironment;
33
34export declare const TestEnvironment: typeof NodeEnvironment;
35
36declare type Timer = {
37 id: number;
38 ref: () => Timer;
39 unref: () => Timer;
40};
41
42export {};