|
f7eb47b…
|
lmata
|
1 |
"use strict"; |
|
f7eb47b…
|
lmata
|
2 |
var __create = Object.create; |
|
f7eb47b…
|
lmata
|
3 |
var __defProp = Object.defineProperty; |
|
f7eb47b…
|
lmata
|
4 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
|
f7eb47b…
|
lmata
|
5 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
|
f7eb47b…
|
lmata
|
6 |
var __getProtoOf = Object.getPrototypeOf; |
|
f7eb47b…
|
lmata
|
7 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
|
f7eb47b…
|
lmata
|
8 |
var __export = (target, all) => { |
|
f7eb47b…
|
lmata
|
9 |
for (var name in all) |
|
f7eb47b…
|
lmata
|
10 |
__defProp(target, name, { get: all[name], enumerable: true }); |
|
f7eb47b…
|
lmata
|
11 |
}; |
|
f7eb47b…
|
lmata
|
12 |
var __copyProps = (to, from, except, desc) => { |
|
f7eb47b…
|
lmata
|
13 |
if (from && typeof from === "object" || typeof from === "function") { |
|
f7eb47b…
|
lmata
|
14 |
for (let key of __getOwnPropNames(from)) |
|
f7eb47b…
|
lmata
|
15 |
if (!__hasOwnProp.call(to, key) && key !== except) |
|
f7eb47b…
|
lmata
|
16 |
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
|
f7eb47b…
|
lmata
|
17 |
} |
|
f7eb47b…
|
lmata
|
18 |
return to; |
|
f7eb47b…
|
lmata
|
19 |
}; |
|
f7eb47b…
|
lmata
|
20 |
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( |
|
f7eb47b…
|
lmata
|
21 |
// If the importer is in node compatibility mode or this is not an ESM |
|
f7eb47b…
|
lmata
|
22 |
// file that has been converted to a CommonJS file using a Babel- |
|
f7eb47b…
|
lmata
|
23 |
// compatible transform (i.e. "__esModule" has not been set), then set |
|
f7eb47b…
|
lmata
|
24 |
// "default" to the CommonJS "module.exports" for node compatibility. |
|
f7eb47b…
|
lmata
|
25 |
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, |
|
f7eb47b…
|
lmata
|
26 |
mod |
|
f7eb47b…
|
lmata
|
27 |
)); |
|
f7eb47b…
|
lmata
|
28 |
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); |
|
f7eb47b…
|
lmata
|
29 |
var reporters_exports = {}; |
|
f7eb47b…
|
lmata
|
30 |
__export(reporters_exports, { |
|
f7eb47b…
|
lmata
|
31 |
createErrorCollectingReporter: () => createErrorCollectingReporter, |
|
f7eb47b…
|
lmata
|
32 |
createReporterForTestServer: () => createReporterForTestServer, |
|
f7eb47b…
|
lmata
|
33 |
createReporters: () => createReporters |
|
f7eb47b…
|
lmata
|
34 |
}); |
|
f7eb47b…
|
lmata
|
35 |
module.exports = __toCommonJS(reporters_exports); |
|
f7eb47b…
|
lmata
|
36 |
var import_utils = require("playwright-core/lib/utils"); |
|
f7eb47b…
|
lmata
|
37 |
var import_loadUtils = require("./loadUtils"); |
|
f7eb47b…
|
lmata
|
38 |
var import_base = require("../reporters/base"); |
|
f7eb47b…
|
lmata
|
39 |
var import_blob = require("../reporters/blob"); |
|
f7eb47b…
|
lmata
|
40 |
var import_dot = __toESM(require("../reporters/dot")); |
|
f7eb47b…
|
lmata
|
41 |
var import_empty = __toESM(require("../reporters/empty")); |
|
f7eb47b…
|
lmata
|
42 |
var import_github = __toESM(require("../reporters/github")); |
|
f7eb47b…
|
lmata
|
43 |
var import_html = __toESM(require("../reporters/html")); |
|
f7eb47b…
|
lmata
|
44 |
var import_json = __toESM(require("../reporters/json")); |
|
f7eb47b…
|
lmata
|
45 |
var import_junit = __toESM(require("../reporters/junit")); |
|
f7eb47b…
|
lmata
|
46 |
var import_line = __toESM(require("../reporters/line")); |
|
f7eb47b…
|
lmata
|
47 |
var import_list = __toESM(require("../reporters/list")); |
|
f7eb47b…
|
lmata
|
48 |
var import_listModeReporter = __toESM(require("../reporters/listModeReporter")); |
|
f7eb47b…
|
lmata
|
49 |
var import_reporterV2 = require("../reporters/reporterV2"); |
|
f7eb47b…
|
lmata
|
50 |
async function createReporters(config, mode, descriptions) { |
|
f7eb47b…
|
lmata
|
51 |
const defaultReporters = { |
|
f7eb47b…
|
lmata
|
52 |
blob: import_blob.BlobReporter, |
|
f7eb47b…
|
lmata
|
53 |
dot: mode === "list" ? import_listModeReporter.default : import_dot.default, |
|
f7eb47b…
|
lmata
|
54 |
line: mode === "list" ? import_listModeReporter.default : import_line.default, |
|
f7eb47b…
|
lmata
|
55 |
list: mode === "list" ? import_listModeReporter.default : import_list.default, |
|
f7eb47b…
|
lmata
|
56 |
github: import_github.default, |
|
f7eb47b…
|
lmata
|
57 |
json: import_json.default, |
|
f7eb47b…
|
lmata
|
58 |
junit: import_junit.default, |
|
f7eb47b…
|
lmata
|
59 |
null: import_empty.default, |
|
f7eb47b…
|
lmata
|
60 |
html: import_html.default |
|
f7eb47b…
|
lmata
|
61 |
}; |
|
f7eb47b…
|
lmata
|
62 |
const reporters = []; |
|
f7eb47b…
|
lmata
|
63 |
descriptions ??= config.config.reporter; |
|
f7eb47b…
|
lmata
|
64 |
if (config.configCLIOverrides.additionalReporters) |
|
f7eb47b…
|
lmata
|
65 |
descriptions = [...descriptions, ...config.configCLIOverrides.additionalReporters]; |
|
f7eb47b…
|
lmata
|
66 |
const runOptions = reporterOptions(config, mode); |
|
f7eb47b…
|
lmata
|
67 |
for (const r of descriptions) { |
|
f7eb47b…
|
lmata
|
68 |
const [name, arg] = r; |
|
f7eb47b…
|
lmata
|
69 |
const options = { ...runOptions, ...arg }; |
|
f7eb47b…
|
lmata
|
70 |
if (name in defaultReporters) { |
|
f7eb47b…
|
lmata
|
71 |
reporters.push(new defaultReporters[name](options)); |
|
f7eb47b…
|
lmata
|
72 |
} else { |
|
f7eb47b…
|
lmata
|
73 |
const reporterConstructor = await (0, import_loadUtils.loadReporter)(config, name); |
|
f7eb47b…
|
lmata
|
74 |
reporters.push((0, import_reporterV2.wrapReporterAsV2)(new reporterConstructor(options))); |
|
f7eb47b…
|
lmata
|
75 |
} |
|
f7eb47b…
|
lmata
|
76 |
} |
|
f7eb47b…
|
lmata
|
77 |
if (process.env.PW_TEST_REPORTER) { |
|
f7eb47b…
|
lmata
|
78 |
const reporterConstructor = await (0, import_loadUtils.loadReporter)(config, process.env.PW_TEST_REPORTER); |
|
f7eb47b…
|
lmata
|
79 |
reporters.push((0, import_reporterV2.wrapReporterAsV2)(new reporterConstructor(runOptions))); |
|
f7eb47b…
|
lmata
|
80 |
} |
|
f7eb47b…
|
lmata
|
81 |
const someReporterPrintsToStdio = reporters.some((r) => r.printsToStdio ? r.printsToStdio() : true); |
|
f7eb47b…
|
lmata
|
82 |
if (reporters.length && !someReporterPrintsToStdio) { |
|
f7eb47b…
|
lmata
|
83 |
if (mode === "list") |
|
f7eb47b…
|
lmata
|
84 |
reporters.unshift(new import_listModeReporter.default()); |
|
f7eb47b…
|
lmata
|
85 |
else if (mode !== "merge") |
|
f7eb47b…
|
lmata
|
86 |
reporters.unshift(!process.env.CI ? new import_line.default() : new import_dot.default()); |
|
f7eb47b…
|
lmata
|
87 |
} |
|
f7eb47b…
|
lmata
|
88 |
return reporters; |
|
f7eb47b…
|
lmata
|
89 |
} |
|
f7eb47b…
|
lmata
|
90 |
async function createReporterForTestServer(file, messageSink) { |
|
f7eb47b…
|
lmata
|
91 |
const reporterConstructor = await (0, import_loadUtils.loadReporter)(null, file); |
|
f7eb47b…
|
lmata
|
92 |
return (0, import_reporterV2.wrapReporterAsV2)(new reporterConstructor({ |
|
f7eb47b…
|
lmata
|
93 |
_send: messageSink |
|
f7eb47b…
|
lmata
|
94 |
})); |
|
f7eb47b…
|
lmata
|
95 |
} |
|
f7eb47b…
|
lmata
|
96 |
function createErrorCollectingReporter(screen) { |
|
f7eb47b…
|
lmata
|
97 |
const errors = []; |
|
f7eb47b…
|
lmata
|
98 |
return { |
|
f7eb47b…
|
lmata
|
99 |
version: () => "v2", |
|
f7eb47b…
|
lmata
|
100 |
onError(error) { |
|
f7eb47b…
|
lmata
|
101 |
errors.push(error); |
|
f7eb47b…
|
lmata
|
102 |
screen.stderr?.write((0, import_base.formatError)(screen, error).message + "\n"); |
|
f7eb47b…
|
lmata
|
103 |
}, |
|
f7eb47b…
|
lmata
|
104 |
errors: () => errors |
|
f7eb47b…
|
lmata
|
105 |
}; |
|
f7eb47b…
|
lmata
|
106 |
} |
|
f7eb47b…
|
lmata
|
107 |
function reporterOptions(config, mode) { |
|
f7eb47b…
|
lmata
|
108 |
return { |
|
f7eb47b…
|
lmata
|
109 |
configDir: config.configDir, |
|
f7eb47b…
|
lmata
|
110 |
_mode: mode, |
|
f7eb47b…
|
lmata
|
111 |
_commandHash: computeCommandHash(config) |
|
f7eb47b…
|
lmata
|
112 |
}; |
|
f7eb47b…
|
lmata
|
113 |
} |
|
f7eb47b…
|
lmata
|
114 |
function computeCommandHash(config) { |
|
f7eb47b…
|
lmata
|
115 |
const parts = []; |
|
f7eb47b…
|
lmata
|
116 |
if (config.cliProjectFilter) |
|
f7eb47b…
|
lmata
|
117 |
parts.push(...config.cliProjectFilter); |
|
f7eb47b…
|
lmata
|
118 |
const command = {}; |
|
f7eb47b…
|
lmata
|
119 |
if (config.cliArgs.length) |
|
f7eb47b…
|
lmata
|
120 |
command.cliArgs = config.cliArgs; |
|
f7eb47b…
|
lmata
|
121 |
if (config.cliGrep) |
|
f7eb47b…
|
lmata
|
122 |
command.cliGrep = config.cliGrep; |
|
f7eb47b…
|
lmata
|
123 |
if (config.cliGrepInvert) |
|
f7eb47b…
|
lmata
|
124 |
command.cliGrepInvert = config.cliGrepInvert; |
|
f7eb47b…
|
lmata
|
125 |
if (config.cliOnlyChanged) |
|
f7eb47b…
|
lmata
|
126 |
command.cliOnlyChanged = config.cliOnlyChanged; |
|
f7eb47b…
|
lmata
|
127 |
if (config.config.tags.length) |
|
f7eb47b…
|
lmata
|
128 |
command.tags = config.config.tags.join(" "); |
|
f7eb47b…
|
lmata
|
129 |
if (Object.keys(command).length) |
|
f7eb47b…
|
lmata
|
130 |
parts.push((0, import_utils.calculateSha1)(JSON.stringify(command)).substring(0, 7)); |
|
f7eb47b…
|
lmata
|
131 |
return parts.join("-"); |
|
f7eb47b…
|
lmata
|
132 |
} |
|
f7eb47b…
|
lmata
|
133 |
// Annotate the CommonJS export names for ESM import in node: |
|
f7eb47b…
|
lmata
|
134 |
0 && (module.exports = { |
|
f7eb47b…
|
lmata
|
135 |
createErrorCollectingReporter, |
|
f7eb47b…
|
lmata
|
136 |
createReporterForTestServer, |
|
f7eb47b…
|
lmata
|
137 |
createReporters |
|
f7eb47b…
|
lmata
|
138 |
}); |