UNPKG

1.01 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 { Context } from 'vm';
9import type { JestEnvironment } from '@jest/environment';
10import { LegacyFakeTimers, ModernFakeTimers } from '@jest/fake-timers';
11import type { Config, Global } from '@jest/types';
12import { ModuleMocker } from 'jest-mock';
13declare type Timer = {
14 id: number;
15 ref: () => Timer;
16 unref: () => Timer;
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 constructor(config: Config.ProjectConfig);
25 setup(): Promise<void>;
26 teardown(): Promise<void>;
27 getVmContext(): Context | null;
28}
29export = NodeEnvironment;