TestScheduler.d.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 { Reporter } from '@jest/reporters';
  8. import { AggregatedResult, Test } from '@jest/test-result';
  9. import type { Config } from '@jest/types';
  10. import type TestWatcher from './TestWatcher';
  11. export declare type TestSchedulerOptions = {
  12. startRun: (globalConfig: Config.GlobalConfig) => void;
  13. };
  14. export declare type TestSchedulerContext = {
  15. firstRun: boolean;
  16. previousSuccess: boolean;
  17. changedFiles?: Set<Config.Path>;
  18. sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
  19. };
  20. export declare function createTestScheduler(globalConfig: Config.GlobalConfig, options: TestSchedulerOptions, context: TestSchedulerContext): Promise<TestScheduler>;
  21. declare class TestScheduler {
  22. private readonly _dispatcher;
  23. private readonly _globalConfig;
  24. private readonly _options;
  25. private readonly _context;
  26. constructor(globalConfig: Config.GlobalConfig, options: TestSchedulerOptions, context: TestSchedulerContext);
  27. addReporter(reporter: Reporter): void;
  28. removeReporter(ReporterClass: Function): void;
  29. scheduleTests(tests: Array<Test>, watcher: TestWatcher): Promise<AggregatedResult>;
  30. private _partitionTests;
  31. private _shouldAddDefaultReporters;
  32. _setupReporters(): Promise<void>;
  33. private _setupDefaultReporters;
  34. private _addCustomReporters;
  35. /**
  36. * Get properties of a reporter in an object
  37. * to make dealing with them less painful.
  38. */
  39. private _getReporterProps;
  40. private _bailIfNeeded;
  41. }
  42. export {};