aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@jest/test-result/build/types.d.ts
blob: c06f477eb33b942ae4d27c90f239555aabf4960c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/**
 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
import type { V8Coverage } from 'collect-v8-coverage';
import type { CoverageMap, CoverageMapData } from 'istanbul-lib-coverage';
import type { ConsoleBuffer } from '@jest/console';
import type { Config, TestResult, TransformTypes } from '@jest/types';
import type { FS as HasteFS, ModuleMap } from 'jest-haste-map';
import type Resolver from 'jest-resolve';
export interface RuntimeTransformResult extends TransformTypes.TransformResult {
    wrapperLength: number;
}
export declare type V8CoverageResult = Array<{
    codeTransformResult: RuntimeTransformResult | undefined;
    result: V8Coverage[number];
}>;
export declare type SerializableError = TestResult.SerializableError;
export declare type FailedAssertion = {
    matcherName?: string;
    message?: string;
    actual?: unknown;
    pass?: boolean;
    passed?: boolean;
    expected?: unknown;
    isNot?: boolean;
    stack?: string;
    error?: unknown;
};
export declare type AssertionLocation = {
    fullName: string;
    path: string;
};
export declare type Status = AssertionResult['status'];
export declare type Bytes = number;
export declare type Milliseconds = TestResult.Milliseconds;
export declare type AssertionResult = TestResult.AssertionResult;
export declare type FormattedAssertionResult = Pick<AssertionResult, 'ancestorTitles' | 'fullName' | 'location' | 'status' | 'title'> & {
    failureMessages: AssertionResult['failureMessages'] | null;
};
export declare type AggregatedResultWithoutCoverage = {
    numFailedTests: number;
    numFailedTestSuites: number;
    numPassedTests: number;
    numPassedTestSuites: number;
    numPendingTests: number;
    numTodoTests: number;
    numPendingTestSuites: number;
    numRuntimeErrorTestSuites: number;
    numTotalTests: number;
    numTotalTestSuites: number;
    openHandles: Array<Error>;
    snapshot: SnapshotSummary;
    startTime: number;
    success: boolean;
    testResults: Array<TestResult>;
    wasInterrupted: boolean;
};
export declare type AggregatedResult = AggregatedResultWithoutCoverage & {
    coverageMap?: CoverageMap | null;
};
export declare type TestResultsProcessor = (results: AggregatedResult) => AggregatedResult;
export declare type Suite = {
    title: string;
    suites: Array<Suite>;
    tests: Array<AssertionResult>;
};
export declare type TestCaseResult = AssertionResult;
export declare type TestResult = {
    console?: ConsoleBuffer;
    coverage?: CoverageMapData;
    displayName?: Config.DisplayName;
    failureMessage?: string | null;
    leaks: boolean;
    memoryUsage?: Bytes;
    numFailingTests: number;
    numPassingTests: number;
    numPendingTests: number;
    numTodoTests: number;
    openHandles: Array<Error>;
    perfStats: {
        end: Milliseconds;
        runtime: Milliseconds;
        slow: boolean;
        start: Milliseconds;
    };
    skipped: boolean;
    snapshot: {
        added: number;
        fileDeleted: boolean;
        matched: number;
        unchecked: number;
        uncheckedKeys: Array<string>;
        unmatched: number;
        updated: number;
    };
    testExecError?: SerializableError;
    testFilePath: Config.Path;
    testResults: Array<AssertionResult>;
    v8Coverage?: V8CoverageResult;
};
export declare type FormattedTestResult = {
    message: string;
    name: string;
    summary: string;
    status: 'failed' | 'passed';
    startTime: number;
    endTime: number;
    coverage: unknown;
    assertionResults: Array<FormattedAssertionResult>;
};
export declare type FormattedTestResults = {
    coverageMap?: CoverageMap | null | undefined;
    numFailedTests: number;
    numFailedTestSuites: number;
    numPassedTests: number;
    numPassedTestSuites: number;
    numPendingTests: number;
    numPendingTestSuites: number;
    numRuntimeErrorTestSuites: number;
    numTotalTests: number;
    numTotalTestSuites: number;
    snapshot: SnapshotSummary;
    startTime: number;
    success: boolean;
    testResults: Array<FormattedTestResult>;
    wasInterrupted: boolean;
};
export declare type CodeCoverageReporter = unknown;
export declare type CodeCoverageFormatter = (coverage: CoverageMapData | null | undefined, reporter: CodeCoverageReporter) => Record<string, unknown> | null | undefined;
export declare type UncheckedSnapshot = {
    filePath: string;
    keys: Array<string>;
};
export declare type SnapshotSummary = {
    added: number;
    didUpdate: boolean;
    failure: boolean;
    filesAdded: number;
    filesRemoved: number;
    filesRemovedList: Array<string>;
    filesUnmatched: number;
    filesUpdated: number;
    matched: number;
    total: number;
    unchecked: number;
    uncheckedKeysByFile: Array<UncheckedSnapshot>;
    unmatched: number;
    updated: number;
};
export declare type Test = {
    context: Context;
    duration?: number;
    path: Config.Path;
};
declare type Context = {
    config: Config.ProjectConfig;
    hasteFS: HasteFS;
    moduleMap: ModuleMap;
    resolver: Resolver;
};
export declare type TestEvents = {
    'test-file-start': [Test];
    'test-file-success': [Test, TestResult];
    'test-file-failure': [Test, SerializableError];
    'test-case-result': [Config.Path, AssertionResult];
};
export declare type TestFileEvent<T extends keyof TestEvents = keyof TestEvents> = (eventName: T, args: TestEvents[T]) => unknown;
export {};