UNPKG

1.69 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 { Reporter } from '@jest/reporters';
8import { AggregatedResult, Test } from '@jest/test-result';
9import type { Config } from '@jest/types';
10import type TestWatcher from './TestWatcher';
11export declare type TestSchedulerOptions = {
12 startRun: (globalConfig: Config.GlobalConfig) => void;
13};
14export declare type TestSchedulerContext = {
15 firstRun: boolean;
16 previousSuccess: boolean;
17 changedFiles?: Set<Config.Path>;
18 sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
19};
20export declare function createTestScheduler(globalConfig: Config.GlobalConfig, options: TestSchedulerOptions, context: TestSchedulerContext): Promise<TestScheduler>;
21declare 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}
42export {};