UNPKG

1.56 kBTypeScriptView Raw
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 */
7import type { Config } from '@jest/types';
8import TestRunner = require('jest-runner');
9import { Reporter } from '@jest/reporters';
10import { AggregatedResult } from '@jest/test-result';
11import type TestWatcher from './TestWatcher';
12export declare type TestSchedulerOptions = {
13 startRun: (globalConfig: Config.GlobalConfig) => void;
14};
15export declare type TestSchedulerContext = {
16 firstRun: boolean;
17 previousSuccess: boolean;
18 changedFiles?: Set<Config.Path>;
19 sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
20};
21export 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}