|
f7eb47b…
|
lmata
|
1 |
"use strict"; |
|
f7eb47b…
|
lmata
|
2 |
var __defProp = Object.defineProperty; |
|
f7eb47b…
|
lmata
|
3 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
|
f7eb47b…
|
lmata
|
4 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
|
f7eb47b…
|
lmata
|
5 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
|
f7eb47b…
|
lmata
|
6 |
var __export = (target, all) => { |
|
f7eb47b…
|
lmata
|
7 |
for (var name in all) |
|
f7eb47b…
|
lmata
|
8 |
__defProp(target, name, { get: all[name], enumerable: true }); |
|
f7eb47b…
|
lmata
|
9 |
}; |
|
f7eb47b…
|
lmata
|
10 |
var __copyProps = (to, from, except, desc) => { |
|
f7eb47b…
|
lmata
|
11 |
if (from && typeof from === "object" || typeof from === "function") { |
|
f7eb47b…
|
lmata
|
12 |
for (let key of __getOwnPropNames(from)) |
|
f7eb47b…
|
lmata
|
13 |
if (!__hasOwnProp.call(to, key) && key !== except) |
|
f7eb47b…
|
lmata
|
14 |
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
|
f7eb47b…
|
lmata
|
15 |
} |
|
f7eb47b…
|
lmata
|
16 |
return to; |
|
f7eb47b…
|
lmata
|
17 |
}; |
|
f7eb47b…
|
lmata
|
18 |
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); |
|
f7eb47b…
|
lmata
|
19 |
var line_exports = {}; |
|
f7eb47b…
|
lmata
|
20 |
__export(line_exports, { |
|
f7eb47b…
|
lmata
|
21 |
default: () => line_default |
|
f7eb47b…
|
lmata
|
22 |
}); |
|
f7eb47b…
|
lmata
|
23 |
module.exports = __toCommonJS(line_exports); |
|
f7eb47b…
|
lmata
|
24 |
var import_base = require("./base"); |
|
f7eb47b…
|
lmata
|
25 |
class LineReporter extends import_base.TerminalReporter { |
|
f7eb47b…
|
lmata
|
26 |
constructor() { |
|
f7eb47b…
|
lmata
|
27 |
super(...arguments); |
|
f7eb47b…
|
lmata
|
28 |
this._current = 0; |
|
f7eb47b…
|
lmata
|
29 |
this._failures = 0; |
|
f7eb47b…
|
lmata
|
30 |
this._didBegin = false; |
|
f7eb47b…
|
lmata
|
31 |
} |
|
f7eb47b…
|
lmata
|
32 |
onBegin(suite) { |
|
f7eb47b…
|
lmata
|
33 |
super.onBegin(suite); |
|
f7eb47b…
|
lmata
|
34 |
const startingMessage = this.generateStartingMessage(); |
|
f7eb47b…
|
lmata
|
35 |
if (startingMessage) { |
|
f7eb47b…
|
lmata
|
36 |
this.writeLine(startingMessage); |
|
f7eb47b…
|
lmata
|
37 |
this.writeLine(); |
|
f7eb47b…
|
lmata
|
38 |
} |
|
f7eb47b…
|
lmata
|
39 |
this._didBegin = true; |
|
f7eb47b…
|
lmata
|
40 |
} |
|
f7eb47b…
|
lmata
|
41 |
onStdOut(chunk, test, result) { |
|
f7eb47b…
|
lmata
|
42 |
super.onStdOut(chunk, test, result); |
|
f7eb47b…
|
lmata
|
43 |
this._dumpToStdio(test, chunk, this.screen.stdout); |
|
f7eb47b…
|
lmata
|
44 |
} |
|
f7eb47b…
|
lmata
|
45 |
onStdErr(chunk, test, result) { |
|
f7eb47b…
|
lmata
|
46 |
super.onStdErr(chunk, test, result); |
|
f7eb47b…
|
lmata
|
47 |
this._dumpToStdio(test, chunk, this.screen.stderr); |
|
f7eb47b…
|
lmata
|
48 |
} |
|
f7eb47b…
|
lmata
|
49 |
_dumpToStdio(test, chunk, stream) { |
|
f7eb47b…
|
lmata
|
50 |
if (this.config.quiet) |
|
f7eb47b…
|
lmata
|
51 |
return; |
|
f7eb47b…
|
lmata
|
52 |
if (!process.env.PW_TEST_DEBUG_REPORTERS) |
|
f7eb47b…
|
lmata
|
53 |
stream.write(`\x1B[1A\x1B[2K`); |
|
f7eb47b…
|
lmata
|
54 |
if (test && this._lastTest !== test) { |
|
f7eb47b…
|
lmata
|
55 |
const title = this.screen.colors.dim(this.formatTestTitle(test)); |
|
f7eb47b…
|
lmata
|
56 |
stream.write(this.fitToScreen(title) + ` |
|
f7eb47b…
|
lmata
|
57 |
`); |
|
f7eb47b…
|
lmata
|
58 |
this._lastTest = test; |
|
f7eb47b…
|
lmata
|
59 |
} |
|
f7eb47b…
|
lmata
|
60 |
stream.write(chunk); |
|
f7eb47b…
|
lmata
|
61 |
if (chunk[chunk.length - 1] !== "\n") |
|
f7eb47b…
|
lmata
|
62 |
this.writeLine(); |
|
f7eb47b…
|
lmata
|
63 |
this.writeLine(); |
|
f7eb47b…
|
lmata
|
64 |
} |
|
f7eb47b…
|
lmata
|
65 |
onTestBegin(test, result) { |
|
f7eb47b…
|
lmata
|
66 |
++this._current; |
|
f7eb47b…
|
lmata
|
67 |
this._updateLine(test, result, void 0); |
|
f7eb47b…
|
lmata
|
68 |
} |
|
f7eb47b…
|
lmata
|
69 |
onStepBegin(test, result, step) { |
|
f7eb47b…
|
lmata
|
70 |
if (this.screen.isTTY && step.category === "test.step") |
|
f7eb47b…
|
lmata
|
71 |
this._updateLine(test, result, step); |
|
f7eb47b…
|
lmata
|
72 |
} |
|
f7eb47b…
|
lmata
|
73 |
onStepEnd(test, result, step) { |
|
f7eb47b…
|
lmata
|
74 |
if (this.screen.isTTY && step.category === "test.step") |
|
f7eb47b…
|
lmata
|
75 |
this._updateLine(test, result, step.parent); |
|
f7eb47b…
|
lmata
|
76 |
} |
|
f7eb47b…
|
lmata
|
77 |
async onTestPaused(test, result) { |
|
f7eb47b…
|
lmata
|
78 |
if (!process.stdin.isTTY && !process.env.PW_TEST_DEBUG_REPORTERS) |
|
f7eb47b…
|
lmata
|
79 |
return; |
|
f7eb47b…
|
lmata
|
80 |
if (!process.env.PW_TEST_DEBUG_REPORTERS) |
|
f7eb47b…
|
lmata
|
81 |
this.screen.stdout.write(`\x1B[1A\x1B[2K`); |
|
f7eb47b…
|
lmata
|
82 |
if (test.outcome() === "unexpected") { |
|
f7eb47b…
|
lmata
|
83 |
this.writeLine(this.screen.colors.red(this.formatTestHeader(test, { indent: " ", index: ++this._failures }))); |
|
f7eb47b…
|
lmata
|
84 |
this.writeLine(this.formatResultErrors(test, result)); |
|
f7eb47b…
|
lmata
|
85 |
(0, import_base.markErrorsAsReported)(result); |
|
f7eb47b…
|
lmata
|
86 |
this.writeLine(this.screen.colors.yellow(` Paused on error. Press Ctrl+C to end.`) + "\n\n"); |
|
f7eb47b…
|
lmata
|
87 |
} else { |
|
f7eb47b…
|
lmata
|
88 |
this.writeLine(this.screen.colors.yellow(this.formatTestHeader(test, { indent: " " }))); |
|
f7eb47b…
|
lmata
|
89 |
this.writeLine(this.screen.colors.yellow(` Paused at test end. Press Ctrl+C to end.`) + "\n\n"); |
|
f7eb47b…
|
lmata
|
90 |
} |
|
f7eb47b…
|
lmata
|
91 |
this._updateLine(test, result, void 0); |
|
f7eb47b…
|
lmata
|
92 |
await new Promise(() => { |
|
f7eb47b…
|
lmata
|
93 |
}); |
|
f7eb47b…
|
lmata
|
94 |
} |
|
f7eb47b…
|
lmata
|
95 |
onTestEnd(test, result) { |
|
f7eb47b…
|
lmata
|
96 |
super.onTestEnd(test, result); |
|
f7eb47b…
|
lmata
|
97 |
if (!this.willRetry(test) && (test.outcome() === "flaky" || test.outcome() === "unexpected" || result.status === "interrupted")) { |
|
f7eb47b…
|
lmata
|
98 |
if (!process.env.PW_TEST_DEBUG_REPORTERS) |
|
f7eb47b…
|
lmata
|
99 |
this.screen.stdout.write(`\x1B[1A\x1B[2K`); |
|
f7eb47b…
|
lmata
|
100 |
this.writeLine(this.formatFailure(test, ++this._failures)); |
|
f7eb47b…
|
lmata
|
101 |
this.writeLine(); |
|
f7eb47b…
|
lmata
|
102 |
} |
|
f7eb47b…
|
lmata
|
103 |
} |
|
f7eb47b…
|
lmata
|
104 |
_updateLine(test, result, step) { |
|
f7eb47b…
|
lmata
|
105 |
const retriesPrefix = this.totalTestCount < this._current ? ` (retries)` : ``; |
|
f7eb47b…
|
lmata
|
106 |
const prefix = `[${this._current}/${this.totalTestCount}]${retriesPrefix} `; |
|
f7eb47b…
|
lmata
|
107 |
const currentRetrySuffix = result.retry ? this.screen.colors.yellow(` (retry #${result.retry})`) : ""; |
|
f7eb47b…
|
lmata
|
108 |
const title = this.formatTestTitle(test, step) + currentRetrySuffix; |
|
f7eb47b…
|
lmata
|
109 |
if (process.env.PW_TEST_DEBUG_REPORTERS) |
|
f7eb47b…
|
lmata
|
110 |
this.screen.stdout.write(`${prefix + title} |
|
f7eb47b…
|
lmata
|
111 |
`); |
|
f7eb47b…
|
lmata
|
112 |
else |
|
f7eb47b…
|
lmata
|
113 |
this.screen.stdout.write(`\x1B[1A\x1B[2K${prefix + this.fitToScreen(title, prefix)} |
|
f7eb47b…
|
lmata
|
114 |
`); |
|
f7eb47b…
|
lmata
|
115 |
} |
|
f7eb47b…
|
lmata
|
116 |
onError(error) { |
|
f7eb47b…
|
lmata
|
117 |
super.onError(error); |
|
f7eb47b…
|
lmata
|
118 |
const message = this.formatError(error).message + "\n"; |
|
f7eb47b…
|
lmata
|
119 |
if (!process.env.PW_TEST_DEBUG_REPORTERS && this._didBegin) |
|
f7eb47b…
|
lmata
|
120 |
this.screen.stdout.write(`\x1B[1A\x1B[2K`); |
|
f7eb47b…
|
lmata
|
121 |
this.screen.stdout.write(message); |
|
f7eb47b…
|
lmata
|
122 |
this.writeLine(); |
|
f7eb47b…
|
lmata
|
123 |
} |
|
f7eb47b…
|
lmata
|
124 |
async onEnd(result) { |
|
f7eb47b…
|
lmata
|
125 |
if (!process.env.PW_TEST_DEBUG_REPORTERS && this._didBegin) |
|
f7eb47b…
|
lmata
|
126 |
this.screen.stdout.write(`\x1B[1A\x1B[2K`); |
|
f7eb47b…
|
lmata
|
127 |
await super.onEnd(result); |
|
f7eb47b…
|
lmata
|
128 |
this.epilogue(false); |
|
f7eb47b…
|
lmata
|
129 |
} |
|
f7eb47b…
|
lmata
|
130 |
} |
|
f7eb47b…
|
lmata
|
131 |
var line_default = LineReporter; |