Env.d.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. */
  8. import { QueueableFn } from '../queueRunner';
  9. import type { AssertionErrorWithStack, Jasmine, Reporter, SpecDefinitionsFn, Spy } from '../types';
  10. import type { default as Spec } from './Spec';
  11. import type Suite from './Suite';
  12. export default function jasmineEnv(j$: Jasmine): {
  13. new (): {
  14. specFilter: (spec: Spec) => boolean;
  15. catchExceptions: (value: unknown) => boolean;
  16. throwOnExpectationFailure: (value: unknown) => void;
  17. catchingExceptions: () => boolean;
  18. topSuite: () => Suite;
  19. fail: (error: Error | AssertionErrorWithStack) => void;
  20. pending: (message: string) => void;
  21. afterAll: (afterAllFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
  22. fit: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec;
  23. throwingExpectationFailures: () => boolean;
  24. randomizeTests: (value: unknown) => void;
  25. randomTests: () => boolean;
  26. seed: (value: unknown) => unknown;
  27. execute: (runnablesToRun?: string[] | undefined, suiteTree?: Suite | undefined) => Promise<void>;
  28. fdescribe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite;
  29. spyOn: (obj: Record<string, Spy>, methodName: string, accessType?: "configurable" | "enumerable" | "value" | "writable" | "get" | "set" | undefined) => Spy;
  30. beforeEach: (beforeEachFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
  31. afterEach: (afterEachFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
  32. clearReporters: () => void;
  33. addReporter: (reporterToAdd: Reporter) => void;
  34. it: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec;
  35. xdescribe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite;
  36. xit: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec;
  37. beforeAll: (beforeAllFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
  38. todo: () => Spec;
  39. provideFallbackReporter: (reporterToAdd: Reporter) => void;
  40. allowRespy: (allow: boolean) => void;
  41. describe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite;
  42. };
  43. };