utils.d.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233
  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. import type { AssertionResult } from '@jest/test-result';
  8. import type { Circus } from '@jest/types';
  9. export declare const makeDescribe: (name: Circus.BlockName, parent?: Circus.DescribeBlock | undefined, mode?: void | "skip" | "only" | "todo" | undefined) => Circus.DescribeBlock;
  10. export declare const makeTest: (fn: Circus.TestFn, mode: Circus.TestMode, name: Circus.TestName, parent: Circus.DescribeBlock, timeout: number | undefined, asyncError: Circus.Exception) => Circus.TestEntry;
  11. declare type DescribeHooks = {
  12. beforeAll: Array<Circus.Hook>;
  13. afterAll: Array<Circus.Hook>;
  14. };
  15. export declare const getAllHooksForDescribe: (describe: Circus.DescribeBlock) => DescribeHooks;
  16. declare type TestHooks = {
  17. beforeEach: Array<Circus.Hook>;
  18. afterEach: Array<Circus.Hook>;
  19. };
  20. export declare const getEachHooksForTest: (test: Circus.TestEntry) => TestHooks;
  21. export declare const describeBlockHasTests: (describe: Circus.DescribeBlock) => boolean;
  22. export declare const callAsyncCircusFn: (testOrHook: Circus.TestEntry | Circus.Hook, testContext: Circus.TestContext | undefined, { isHook, timeout }: {
  23. isHook: boolean;
  24. timeout: number;
  25. }) => Promise<unknown>;
  26. export declare const getTestDuration: (test: Circus.TestEntry) => number | null;
  27. export declare const makeRunResult: (describeBlock: Circus.DescribeBlock, unhandledErrors: Array<Error>) => Circus.RunResult;
  28. export declare const makeSingleTestResult: (test: Circus.TestEntry) => Circus.TestResult;
  29. export declare const getTestID: (test: Circus.TestEntry) => string;
  30. export declare const addErrorToEachTestUnderDescribe: (describeBlock: Circus.DescribeBlock, error: Circus.Exception, asyncError: Circus.Exception) => void;
  31. export declare function invariant(condition: unknown, message?: string): asserts condition;
  32. export declare const parseSingleTestResult: (testResult: Circus.TestResult) => AssertionResult;
  33. export {};