index.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  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" />
  8. import type { Context } from 'vm';
  9. import type { EnvironmentContext, JestEnvironment } from '@jest/environment';
  10. import { LegacyFakeTimers, ModernFakeTimers } from '@jest/fake-timers';
  11. import type { Config, Global } from '@jest/types';
  12. import { ModuleMocker } from 'jest-mock';
  13. declare type Win = Window & Global.Global & {
  14. Error: {
  15. stackTraceLimit: number;
  16. };
  17. };
  18. declare class JSDOMEnvironment implements JestEnvironment<number> {
  19. private dom;
  20. fakeTimers: LegacyFakeTimers<number> | null;
  21. fakeTimersModern: ModernFakeTimers | null;
  22. global: Win;
  23. private errorEventListener;
  24. moduleMocker: ModuleMocker | null;
  25. constructor(config: Config.ProjectConfig, options?: EnvironmentContext);
  26. setup(): Promise<void>;
  27. teardown(): Promise<void>;
  28. getVmContext(): Context | null;
  29. }
  30. export = JSDOMEnvironment;