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 Emittery = require('emittery');
8import type { JestEnvironment } from '@jest/environment';
9import type { SerializableError, Test, TestFileEvent, TestResult } from '@jest/test-result';
10import type { Config } from '@jest/types';
11import type RuntimeType from 'jest-runtime';
12export declare type ErrorWithCode = Error & {
13 code?: string;
14};
15export declare type OnTestStart = (test: Test) => Promise<void>;
16export declare type OnTestFailure = (test: Test, serializableError: SerializableError) => Promise<void>;
17export declare type OnTestSuccess = (test: Test, testResult: TestResult) => Promise<void>;
18export declare type TestFramework = (globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, environment: JestEnvironment, runtime: RuntimeType, testPath: string, sendMessageToJest?: TestFileEvent) => Promise<TestResult>;
19export declare type TestRunnerOptions = {
20 serial: boolean;
21};
22export declare type TestRunnerContext = {
23 changedFiles?: Set<Config.Path>;
24 sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
25};
26export declare type TestRunnerSerializedContext = {
27 changedFiles?: Array<Config.Path>;
28 sourcesRelatedToTestsInChangedFiles?: Array<Config.Path>;
29};
30declare type WatcherState = {
31 interrupted: boolean;
32};
33export interface TestWatcher extends Emittery<{
34 change: WatcherState;
35}> {
36 state: WatcherState;
37 setState(state: WatcherState): void;
38 isInterrupted(): boolean;
39 isWatchMode(): boolean;
40}
41export {};