|
| 1 | +type ErrorSource = { |
| 2 | + isDependency: boolean; |
| 3 | + isWithinProject: boolean; |
| 4 | + file: string; |
| 5 | + line: number; |
| 6 | +}; |
| 7 | + |
| 8 | +type SerializedErrorBase = { |
| 9 | + message: string; |
| 10 | + name: string; |
| 11 | + originalError: unknown; |
| 12 | + stack: string; |
| 13 | +}; |
| 14 | + |
| 15 | +type AggregateSerializedError = SerializedErrorBase & { |
| 16 | + type: 'aggregate'; |
| 17 | + errors: SerializedError[]; |
| 18 | +}; |
| 19 | + |
| 20 | +type NativeSerializedError = SerializedErrorBase & { |
| 21 | + type: 'native'; |
| 22 | + source: ErrorSource | undefined; |
| 23 | +}; |
| 24 | + |
| 25 | +type AvaSerializedError = SerializedErrorBase & { |
| 26 | + type: 'ava'; |
| 27 | + assertion: string; |
| 28 | + improperUsage: unknown | undefined; |
| 29 | + formattedCause: unknown | undefined; |
| 30 | + formattedDetails: unknown | unknown[]; |
| 31 | + source: ErrorSource | undefined; |
| 32 | +}; |
| 33 | + |
| 34 | +type SerializedError = AggregateSerializedError | NativeSerializedError | AvaSerializedError; |
| 35 | + |
| 36 | +export type StateChangeEvent = { |
| 37 | + type: 'starting'; |
| 38 | + testFile: string; |
| 39 | +} | { |
| 40 | + type: 'stats'; |
| 41 | + stats: { |
| 42 | + byFile: Map<string, { |
| 43 | + declaredTests: number; |
| 44 | + failedHooks: number; |
| 45 | + failedTests: number; |
| 46 | + internalErrors: number; |
| 47 | + remainingTests: number; |
| 48 | + passedKnownFailingTests: number; |
| 49 | + passedTests: number; |
| 50 | + selectedTests: number; |
| 51 | + selectingLines: boolean; |
| 52 | + skippedTests: number; |
| 53 | + todoTests: number; |
| 54 | + uncaughtExceptions: number; |
| 55 | + unhandledRejections: number; |
| 56 | + }>; |
| 57 | + declaredTests: number; |
| 58 | + failedHooks: number; |
| 59 | + failedTests: number; |
| 60 | + failedWorkers: number; |
| 61 | + files: number; |
| 62 | + parallelRuns: { |
| 63 | + currentIndex: number; |
| 64 | + totalRuns: number; |
| 65 | + } | undefined; |
| 66 | + finishedWorkers: number; |
| 67 | + internalErrors: number; |
| 68 | + remainingTests: number; |
| 69 | + passedKnownFailingTests: number; |
| 70 | + passedTests: number; |
| 71 | + selectedTests: number; |
| 72 | + sharedWorkerErrors: number; |
| 73 | + skippedTests: number; |
| 74 | + timedOutTests: number; |
| 75 | + timeouts: number; |
| 76 | + todoTests: number; |
| 77 | + uncaughtExceptions: number; |
| 78 | + unhandledRejections: number; |
| 79 | + }; |
| 80 | +} | { |
| 81 | + type: 'declared-test'; |
| 82 | + title: string; |
| 83 | + knownFailing: boolean; |
| 84 | + todo: boolean; |
| 85 | + testFile: string; |
| 86 | +} | { |
| 87 | + type: 'selected-test'; |
| 88 | + title: string; |
| 89 | + knownFailing: boolean; |
| 90 | + skip: boolean; |
| 91 | + todo: boolean; |
| 92 | + testFile: string; |
| 93 | +} | { |
| 94 | + type: 'test-register-log-reference'; |
| 95 | + title: string; |
| 96 | + logs: string[]; |
| 97 | + testFile: string; |
| 98 | +} | { |
| 99 | + type: 'test-passed'; |
| 100 | + title: string; |
| 101 | + duration: number; |
| 102 | + knownFailing: boolean; |
| 103 | + logs: string[]; |
| 104 | + testFile: string; |
| 105 | +} | { |
| 106 | + type: 'test-failed'; |
| 107 | + title: string; |
| 108 | + err: SerializedError; |
| 109 | + duration: number; |
| 110 | + knownFailing: boolean; |
| 111 | + logs: string[]; |
| 112 | + testFile: string; |
| 113 | +} | { |
| 114 | + type: 'worker-finished'; |
| 115 | + forcedExit: boolean; |
| 116 | + testFile: string; |
| 117 | +} | { |
| 118 | + type: 'worker-failed'; |
| 119 | + nonZeroExitCode?: boolean; |
| 120 | + signal?: string; |
| 121 | + err?: SerializedError; |
| 122 | +} | { |
| 123 | + type: 'touched-files'; |
| 124 | + files: { |
| 125 | + changedFiles: string[]; |
| 126 | + temporaryFiles: string[]; |
| 127 | + }; |
| 128 | +} | { |
| 129 | + type: 'worker-stdout'; |
| 130 | + chunk: Uint8Array; |
| 131 | + testFile: string; |
| 132 | +} | { |
| 133 | + type: 'worker-stderr'; |
| 134 | + chunk: Uint8Array; |
| 135 | + testFile: string; |
| 136 | +} | { |
| 137 | + type: 'timeout'; |
| 138 | + period: number; |
| 139 | + pendingTests: Map<string, Set<string>>; |
| 140 | +} |
| 141 | +| { |
| 142 | + type: 'end'; |
| 143 | +}; |
0 commit comments