TestScheduler.d.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 } from '@jest/test-result';
  9. import type { Config } from '@jest/types';
  10. import TestRunner = require('jest-runner');
  11. import type TestWatcher from './TestWatcher';
  12. export declare type TestSchedulerOptions = {
  13. startRun: (globalConfig: Config.GlobalConfig) => void;
  14. };
  15. export declare type TestSchedulerContext = {
  16. firstRun: boolean;
  17. previousSuccess: boolean;
  18. changedFiles?: Set<Config.Path>;
  19. sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
  20. };
  21. export default 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<TestRunner.Test>, watcher: TestWatcher): Promise<AggregatedResult>;
  30. private _partitionTests;
  31. private _shouldAddDefaultReporters;
  32. private _setupReporters;
  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. }