index.d.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435
  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 Emittery = require('emittery');
  8. import type { Config } from '@jest/types';
  9. import type { OnTestFailure as JestOnTestFailure, OnTestStart as JestOnTestStart, OnTestSuccess as JestOnTestSuccess, Test as JestTest, TestEvents as JestTestEvents, TestFileEvent as JestTestFileEvent, TestRunnerContext as JestTestRunnerContext, TestRunnerOptions as JestTestRunnerOptions, TestWatcher as JestTestWatcher } from './types';
  10. declare namespace TestRunner {
  11. type Test = JestTest;
  12. type OnTestFailure = JestOnTestFailure;
  13. type OnTestStart = JestOnTestStart;
  14. type OnTestSuccess = JestOnTestSuccess;
  15. type TestWatcher = JestTestWatcher;
  16. type TestRunnerContext = JestTestRunnerContext;
  17. type TestRunnerOptions = JestTestRunnerOptions;
  18. type TestFileEvent = JestTestFileEvent;
  19. }
  20. declare class TestRunner {
  21. private readonly _globalConfig;
  22. private readonly _context;
  23. private readonly eventEmitter;
  24. readonly __PRIVATE_UNSTABLE_API_supportsEventEmitters__: boolean;
  25. readonly isSerial?: boolean;
  26. constructor(globalConfig: Config.GlobalConfig, context?: JestTestRunnerContext);
  27. runTests(tests: Array<JestTest>, watcher: JestTestWatcher, onStart: JestOnTestStart | undefined, onResult: JestOnTestSuccess | undefined, onFailure: JestOnTestFailure | undefined, options: JestTestRunnerOptions): Promise<void>;
  28. private _createInBandTestRun;
  29. private _createParallelTestRun;
  30. on: {
  31. <Name extends "test-file-start" | "test-file-success" | "test-file-failure" | "test-case-result">(eventName: Name, listener: (eventData: JestTestEvents[Name]) => void): Emittery.UnsubscribeFn;
  32. <Name_1 extends never>(eventName: Name_1, listener: () => void): Emittery.UnsubscribeFn;
  33. };
  34. }
  35. export = TestRunner;