jestAdapterInit.d.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 BabelTraverse from '@babel/traverse';
  9. import type { Config, Global } from '@jest/types';
  10. import type { JestEnvironment } from '@jest/environment';
  11. import { TestResult } from '@jest/test-result';
  12. import type { TestFileEvent } from 'jest-runner';
  13. import { SnapshotStateType } from 'jest-snapshot';
  14. import globals from '..';
  15. import { Expect } from './jestExpect';
  16. declare type Process = NodeJS.Process;
  17. interface JestGlobals extends Global.TestFrameworkGlobals {
  18. expect: Expect;
  19. }
  20. export declare const initialize: ({ config, environment, getPrettier, getBabelTraverse, globalConfig, localRequire, parentProcess, sendMessageToJest, setGlobalsForRuntime, testPath, }: {
  21. config: Config.ProjectConfig;
  22. environment: JestEnvironment;
  23. getPrettier: () => null | any;
  24. getBabelTraverse: () => typeof BabelTraverse;
  25. globalConfig: Config.GlobalConfig;
  26. localRequire: <T = unknown>(path: Config.Path) => T;
  27. testPath: Config.Path;
  28. parentProcess: Process;
  29. sendMessageToJest?: import("jest-runner/build/types").TestFileEvent<"test-file-start" | "test-file-success" | "test-file-failure" | "test-case-result"> | undefined;
  30. setGlobalsForRuntime?: ((globals: JestGlobals) => void) | undefined;
  31. }) => Promise<{
  32. globals: Global.TestFrameworkGlobals;
  33. snapshotState: SnapshotStateType;
  34. }>;
  35. export declare const runAndTransformResultsToJestFormat: ({ config, globalConfig, testPath, }: {
  36. config: Config.ProjectConfig;
  37. globalConfig: Config.GlobalConfig;
  38. testPath: string;
  39. }) => Promise<TestResult>;
  40. export {};