ScuttleBot

scuttlebot / tests / e2e / node_modules / playwright / lib / isomorphic / teleReceiver.js
Source Blame History 521 lines
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 teleReceiver_exports = {};
f7eb47b… lmata 20 __export(teleReceiver_exports, {
f7eb47b… lmata 21 TeleReporterReceiver: () => TeleReporterReceiver,
f7eb47b… lmata 22 TeleSuite: () => TeleSuite,
f7eb47b… lmata 23 TeleTestCase: () => TeleTestCase,
f7eb47b… lmata 24 TeleTestResult: () => TeleTestResult,
f7eb47b… lmata 25 baseFullConfig: () => baseFullConfig,
f7eb47b… lmata 26 computeTestCaseOutcome: () => computeTestCaseOutcome,
f7eb47b… lmata 27 parseRegexPatterns: () => parseRegexPatterns,
f7eb47b… lmata 28 serializeRegexPatterns: () => serializeRegexPatterns
f7eb47b… lmata 29 });
f7eb47b… lmata 30 module.exports = __toCommonJS(teleReceiver_exports);
f7eb47b… lmata 31 class TeleReporterReceiver {
f7eb47b… lmata 32 constructor(reporter, options = {}) {
f7eb47b… lmata 33 this.isListing = false;
f7eb47b… lmata 34 this._tests = /* @__PURE__ */ new Map();
f7eb47b… lmata 35 this._rootSuite = new TeleSuite("", "root");
f7eb47b… lmata 36 this._options = options;
f7eb47b… lmata 37 this._reporter = reporter;
f7eb47b… lmata 38 }
f7eb47b… lmata 39 reset() {
f7eb47b… lmata 40 this._rootSuite._entries = [];
f7eb47b… lmata 41 this._tests.clear();
f7eb47b… lmata 42 }
f7eb47b… lmata 43 dispatch(message) {
f7eb47b… lmata 44 const { method, params } = message;
f7eb47b… lmata 45 if (method === "onConfigure") {
f7eb47b… lmata 46 this._onConfigure(params.config);
f7eb47b… lmata 47 return;
f7eb47b… lmata 48 }
f7eb47b… lmata 49 if (method === "onProject") {
f7eb47b… lmata 50 this._onProject(params.project);
f7eb47b… lmata 51 return;
f7eb47b… lmata 52 }
f7eb47b… lmata 53 if (method === "onBegin") {
f7eb47b… lmata 54 this._onBegin();
f7eb47b… lmata 55 return;
f7eb47b… lmata 56 }
f7eb47b… lmata 57 if (method === "onTestBegin") {
f7eb47b… lmata 58 this._onTestBegin(params.testId, params.result);
f7eb47b… lmata 59 return;
f7eb47b… lmata 60 }
f7eb47b… lmata 61 if (method === "onTestPaused") {
f7eb47b… lmata 62 this._onTestPaused(params.testId, params.resultId, params.errors);
f7eb47b… lmata 63 return;
f7eb47b… lmata 64 }
f7eb47b… lmata 65 if (method === "onTestEnd") {
f7eb47b… lmata 66 this._onTestEnd(params.test, params.result);
f7eb47b… lmata 67 return;
f7eb47b… lmata 68 }
f7eb47b… lmata 69 if (method === "onStepBegin") {
f7eb47b… lmata 70 this._onStepBegin(params.testId, params.resultId, params.step);
f7eb47b… lmata 71 return;
f7eb47b… lmata 72 }
f7eb47b… lmata 73 if (method === "onAttach") {
f7eb47b… lmata 74 this._onAttach(params.testId, params.resultId, params.attachments);
f7eb47b… lmata 75 return;
f7eb47b… lmata 76 }
f7eb47b… lmata 77 if (method === "onStepEnd") {
f7eb47b… lmata 78 this._onStepEnd(params.testId, params.resultId, params.step);
f7eb47b… lmata 79 return;
f7eb47b… lmata 80 }
f7eb47b… lmata 81 if (method === "onError") {
f7eb47b… lmata 82 this._onError(params.error);
f7eb47b… lmata 83 return;
f7eb47b… lmata 84 }
f7eb47b… lmata 85 if (method === "onStdIO") {
f7eb47b… lmata 86 this._onStdIO(params.type, params.testId, params.resultId, params.data, params.isBase64);
f7eb47b… lmata 87 return;
f7eb47b… lmata 88 }
f7eb47b… lmata 89 if (method === "onEnd")
f7eb47b… lmata 90 return this._onEnd(params.result);
f7eb47b… lmata 91 if (method === "onExit")
f7eb47b… lmata 92 return this._onExit();
f7eb47b… lmata 93 }
f7eb47b… lmata 94 _onConfigure(config) {
f7eb47b… lmata 95 this._rootDir = config.rootDir;
f7eb47b… lmata 96 this._config = this._parseConfig(config);
f7eb47b… lmata 97 this._reporter.onConfigure?.(this._config);
f7eb47b… lmata 98 }
f7eb47b… lmata 99 _onProject(project) {
f7eb47b… lmata 100 let projectSuite = this._options.mergeProjects ? this._rootSuite.suites.find((suite) => suite.project().name === project.name) : void 0;
f7eb47b… lmata 101 if (!projectSuite) {
f7eb47b… lmata 102 projectSuite = new TeleSuite(project.name, "project");
f7eb47b… lmata 103 this._rootSuite._addSuite(projectSuite);
f7eb47b… lmata 104 }
f7eb47b… lmata 105 projectSuite._project = this._parseProject(project);
f7eb47b… lmata 106 for (const suite of project.suites)
f7eb47b… lmata 107 this._mergeSuiteInto(suite, projectSuite);
f7eb47b… lmata 108 }
f7eb47b… lmata 109 _onBegin() {
f7eb47b… lmata 110 this._reporter.onBegin?.(this._rootSuite);
f7eb47b… lmata 111 }
f7eb47b… lmata 112 _onTestBegin(testId, payload) {
f7eb47b… lmata 113 const test = this._tests.get(testId);
f7eb47b… lmata 114 if (this._options.clearPreviousResultsWhenTestBegins)
f7eb47b… lmata 115 test.results = [];
f7eb47b… lmata 116 const testResult = test._createTestResult(payload.id);
f7eb47b… lmata 117 testResult.retry = payload.retry;
f7eb47b… lmata 118 testResult.workerIndex = payload.workerIndex;
f7eb47b… lmata 119 testResult.parallelIndex = payload.parallelIndex;
f7eb47b… lmata 120 testResult.setStartTimeNumber(payload.startTime);
f7eb47b… lmata 121 this._reporter.onTestBegin?.(test, testResult);
f7eb47b… lmata 122 }
f7eb47b… lmata 123 _onTestPaused(testId, resultId, errors) {
f7eb47b… lmata 124 const test = this._tests.get(testId);
f7eb47b… lmata 125 const result = test.results.find((r) => r._id === resultId);
f7eb47b… lmata 126 result.errors.push(...errors);
f7eb47b… lmata 127 result.error = result.errors[0];
f7eb47b… lmata 128 void this._reporter.onTestPaused?.(test, result);
f7eb47b… lmata 129 }
f7eb47b… lmata 130 _onTestEnd(testEndPayload, payload) {
f7eb47b… lmata 131 const test = this._tests.get(testEndPayload.testId);
f7eb47b… lmata 132 test.timeout = testEndPayload.timeout;
f7eb47b… lmata 133 test.expectedStatus = testEndPayload.expectedStatus;
f7eb47b… lmata 134 const result = test.results.find((r) => r._id === payload.id);
f7eb47b… lmata 135 result.duration = payload.duration;
f7eb47b… lmata 136 result.status = payload.status;
f7eb47b… lmata 137 result.errors.push(...payload.errors ?? []);
f7eb47b… lmata 138 result.error = result.errors[0];
f7eb47b… lmata 139 if (!!payload.attachments)
f7eb47b… lmata 140 result.attachments = this._parseAttachments(payload.attachments);
f7eb47b… lmata 141 if (payload.annotations) {
f7eb47b… lmata 142 this._absoluteAnnotationLocationsInplace(payload.annotations);
f7eb47b… lmata 143 result.annotations = payload.annotations;
f7eb47b… lmata 144 test.annotations = payload.annotations;
f7eb47b… lmata 145 }
f7eb47b… lmata 146 this._reporter.onTestEnd?.(test, result);
f7eb47b… lmata 147 result._stepMap = /* @__PURE__ */ new Map();
f7eb47b… lmata 148 }
f7eb47b… lmata 149 _onStepBegin(testId, resultId, payload) {
f7eb47b… lmata 150 const test = this._tests.get(testId);
f7eb47b… lmata 151 const result = test.results.find((r) => r._id === resultId);
f7eb47b… lmata 152 const parentStep = payload.parentStepId ? result._stepMap.get(payload.parentStepId) : void 0;
f7eb47b… lmata 153 const location = this._absoluteLocation(payload.location);
f7eb47b… lmata 154 const step = new TeleTestStep(payload, parentStep, location, result);
f7eb47b… lmata 155 if (parentStep)
f7eb47b… lmata 156 parentStep.steps.push(step);
f7eb47b… lmata 157 else
f7eb47b… lmata 158 result.steps.push(step);
f7eb47b… lmata 159 result._stepMap.set(payload.id, step);
f7eb47b… lmata 160 this._reporter.onStepBegin?.(test, result, step);
f7eb47b… lmata 161 }
f7eb47b… lmata 162 _onStepEnd(testId, resultId, payload) {
f7eb47b… lmata 163 const test = this._tests.get(testId);
f7eb47b… lmata 164 const result = test.results.find((r) => r._id === resultId);
f7eb47b… lmata 165 const step = result._stepMap.get(payload.id);
f7eb47b… lmata 166 step._endPayload = payload;
f7eb47b… lmata 167 step.duration = payload.duration;
f7eb47b… lmata 168 step.error = payload.error;
f7eb47b… lmata 169 this._reporter.onStepEnd?.(test, result, step);
f7eb47b… lmata 170 }
f7eb47b… lmata 171 _onAttach(testId, resultId, attachments) {
f7eb47b… lmata 172 const test = this._tests.get(testId);
f7eb47b… lmata 173 const result = test.results.find((r) => r._id === resultId);
f7eb47b… lmata 174 result.attachments.push(...attachments.map((a) => ({
f7eb47b… lmata 175 name: a.name,
f7eb47b… lmata 176 contentType: a.contentType,
f7eb47b… lmata 177 path: a.path,
f7eb47b… lmata 178 body: a.base64 && globalThis.Buffer ? Buffer.from(a.base64, "base64") : void 0
f7eb47b… lmata 179 })));
f7eb47b… lmata 180 }
f7eb47b… lmata 181 _onError(error) {
f7eb47b… lmata 182 this._reporter.onError?.(error);
f7eb47b… lmata 183 }
f7eb47b… lmata 184 _onStdIO(type, testId, resultId, data, isBase64) {
f7eb47b… lmata 185 const chunk = isBase64 ? globalThis.Buffer ? Buffer.from(data, "base64") : atob(data) : data;
f7eb47b… lmata 186 const test = testId ? this._tests.get(testId) : void 0;
f7eb47b… lmata 187 const result = test && resultId ? test.results.find((r) => r._id === resultId) : void 0;
f7eb47b… lmata 188 if (type === "stdout") {
f7eb47b… lmata 189 result?.stdout.push(chunk);
f7eb47b… lmata 190 this._reporter.onStdOut?.(chunk, test, result);
f7eb47b… lmata 191 } else {
f7eb47b… lmata 192 result?.stderr.push(chunk);
f7eb47b… lmata 193 this._reporter.onStdErr?.(chunk, test, result);
f7eb47b… lmata 194 }
f7eb47b… lmata 195 }
f7eb47b… lmata 196 async _onEnd(result) {
f7eb47b… lmata 197 await this._reporter.onEnd?.({
f7eb47b… lmata 198 status: result.status,
f7eb47b… lmata 199 startTime: new Date(result.startTime),
f7eb47b… lmata 200 duration: result.duration
f7eb47b… lmata 201 });
f7eb47b… lmata 202 }
f7eb47b… lmata 203 _onExit() {
f7eb47b… lmata 204 return this._reporter.onExit?.();
f7eb47b… lmata 205 }
f7eb47b… lmata 206 _parseConfig(config) {
f7eb47b… lmata 207 const result = { ...baseFullConfig, ...config };
f7eb47b… lmata 208 if (this._options.configOverrides) {
f7eb47b… lmata 209 result.configFile = this._options.configOverrides.configFile;
f7eb47b… lmata 210 result.reportSlowTests = this._options.configOverrides.reportSlowTests;
f7eb47b… lmata 211 result.quiet = this._options.configOverrides.quiet;
f7eb47b… lmata 212 result.reporter = [...this._options.configOverrides.reporter];
f7eb47b… lmata 213 }
f7eb47b… lmata 214 return result;
f7eb47b… lmata 215 }
f7eb47b… lmata 216 _parseProject(project) {
f7eb47b… lmata 217 return {
f7eb47b… lmata 218 metadata: project.metadata,
f7eb47b… lmata 219 name: project.name,
f7eb47b… lmata 220 outputDir: this._absolutePath(project.outputDir),
f7eb47b… lmata 221 repeatEach: project.repeatEach,
f7eb47b… lmata 222 retries: project.retries,
f7eb47b… lmata 223 testDir: this._absolutePath(project.testDir),
f7eb47b… lmata 224 testIgnore: parseRegexPatterns(project.testIgnore),
f7eb47b… lmata 225 testMatch: parseRegexPatterns(project.testMatch),
f7eb47b… lmata 226 timeout: project.timeout,
f7eb47b… lmata 227 grep: parseRegexPatterns(project.grep),
f7eb47b… lmata 228 grepInvert: parseRegexPatterns(project.grepInvert),
f7eb47b… lmata 229 dependencies: project.dependencies,
f7eb47b… lmata 230 teardown: project.teardown,
f7eb47b… lmata 231 snapshotDir: this._absolutePath(project.snapshotDir),
f7eb47b… lmata 232 use: project.use
f7eb47b… lmata 233 };
f7eb47b… lmata 234 }
f7eb47b… lmata 235 _parseAttachments(attachments) {
f7eb47b… lmata 236 return attachments.map((a) => {
f7eb47b… lmata 237 return {
f7eb47b… lmata 238 ...a,
f7eb47b… lmata 239 body: a.base64 && globalThis.Buffer ? Buffer.from(a.base64, "base64") : void 0
f7eb47b… lmata 240 };
f7eb47b… lmata 241 });
f7eb47b… lmata 242 }
f7eb47b… lmata 243 _mergeSuiteInto(jsonSuite, parent) {
f7eb47b… lmata 244 let targetSuite = parent.suites.find((s) => s.title === jsonSuite.title);
f7eb47b… lmata 245 if (!targetSuite) {
f7eb47b… lmata 246 targetSuite = new TeleSuite(jsonSuite.title, parent.type === "project" ? "file" : "describe");
f7eb47b… lmata 247 parent._addSuite(targetSuite);
f7eb47b… lmata 248 }
f7eb47b… lmata 249 targetSuite.location = this._absoluteLocation(jsonSuite.location);
f7eb47b… lmata 250 jsonSuite.entries.forEach((e) => {
f7eb47b… lmata 251 if ("testId" in e)
f7eb47b… lmata 252 this._mergeTestInto(e, targetSuite);
f7eb47b… lmata 253 else
f7eb47b… lmata 254 this._mergeSuiteInto(e, targetSuite);
f7eb47b… lmata 255 });
f7eb47b… lmata 256 }
f7eb47b… lmata 257 _mergeTestInto(jsonTest, parent) {
f7eb47b… lmata 258 let targetTest = this._options.mergeTestCases ? parent.tests.find((s) => s.title === jsonTest.title && s.repeatEachIndex === jsonTest.repeatEachIndex) : void 0;
f7eb47b… lmata 259 if (!targetTest) {
f7eb47b… lmata 260 targetTest = new TeleTestCase(jsonTest.testId, jsonTest.title, this._absoluteLocation(jsonTest.location), jsonTest.repeatEachIndex);
f7eb47b… lmata 261 parent._addTest(targetTest);
f7eb47b… lmata 262 this._tests.set(targetTest.id, targetTest);
f7eb47b… lmata 263 }
f7eb47b… lmata 264 this._updateTest(jsonTest, targetTest);
f7eb47b… lmata 265 }
f7eb47b… lmata 266 _updateTest(payload, test) {
f7eb47b… lmata 267 test.id = payload.testId;
f7eb47b… lmata 268 test.location = this._absoluteLocation(payload.location);
f7eb47b… lmata 269 test.retries = payload.retries;
f7eb47b… lmata 270 test.tags = payload.tags ?? [];
f7eb47b… lmata 271 test.annotations = payload.annotations ?? [];
f7eb47b… lmata 272 this._absoluteAnnotationLocationsInplace(test.annotations);
f7eb47b… lmata 273 return test;
f7eb47b… lmata 274 }
f7eb47b… lmata 275 _absoluteAnnotationLocationsInplace(annotations) {
f7eb47b… lmata 276 for (const annotation of annotations) {
f7eb47b… lmata 277 if (annotation.location)
f7eb47b… lmata 278 annotation.location = this._absoluteLocation(annotation.location);
f7eb47b… lmata 279 }
f7eb47b… lmata 280 }
f7eb47b… lmata 281 _absoluteLocation(location) {
f7eb47b… lmata 282 if (!location)
f7eb47b… lmata 283 return location;
f7eb47b… lmata 284 return {
f7eb47b… lmata 285 ...location,
f7eb47b… lmata 286 file: this._absolutePath(location.file)
f7eb47b… lmata 287 };
f7eb47b… lmata 288 }
f7eb47b… lmata 289 _absolutePath(relativePath) {
f7eb47b… lmata 290 if (relativePath === void 0)
f7eb47b… lmata 291 return;
f7eb47b… lmata 292 return this._options.resolvePath ? this._options.resolvePath(this._rootDir, relativePath) : this._rootDir + "/" + relativePath;
f7eb47b… lmata 293 }
f7eb47b… lmata 294 }
f7eb47b… lmata 295 class TeleSuite {
f7eb47b… lmata 296 constructor(title, type) {
f7eb47b… lmata 297 this._entries = [];
f7eb47b… lmata 298 this._requireFile = "";
f7eb47b… lmata 299 this._parallelMode = "none";
f7eb47b… lmata 300 this.title = title;
f7eb47b… lmata 301 this._type = type;
f7eb47b… lmata 302 }
f7eb47b… lmata 303 get type() {
f7eb47b… lmata 304 return this._type;
f7eb47b… lmata 305 }
f7eb47b… lmata 306 get suites() {
f7eb47b… lmata 307 return this._entries.filter((e) => e.type !== "test");
f7eb47b… lmata 308 }
f7eb47b… lmata 309 get tests() {
f7eb47b… lmata 310 return this._entries.filter((e) => e.type === "test");
f7eb47b… lmata 311 }
f7eb47b… lmata 312 entries() {
f7eb47b… lmata 313 return this._entries;
f7eb47b… lmata 314 }
f7eb47b… lmata 315 allTests() {
f7eb47b… lmata 316 const result = [];
f7eb47b… lmata 317 const visit = (suite) => {
f7eb47b… lmata 318 for (const entry of suite.entries()) {
f7eb47b… lmata 319 if (entry.type === "test")
f7eb47b… lmata 320 result.push(entry);
f7eb47b… lmata 321 else
f7eb47b… lmata 322 visit(entry);
f7eb47b… lmata 323 }
f7eb47b… lmata 324 };
f7eb47b… lmata 325 visit(this);
f7eb47b… lmata 326 return result;
f7eb47b… lmata 327 }
f7eb47b… lmata 328 titlePath() {
f7eb47b… lmata 329 const titlePath = this.parent ? this.parent.titlePath() : [];
f7eb47b… lmata 330 if (this.title || this._type !== "describe")
f7eb47b… lmata 331 titlePath.push(this.title);
f7eb47b… lmata 332 return titlePath;
f7eb47b… lmata 333 }
f7eb47b… lmata 334 project() {
f7eb47b… lmata 335 return this._project ?? this.parent?.project();
f7eb47b… lmata 336 }
f7eb47b… lmata 337 _addTest(test) {
f7eb47b… lmata 338 test.parent = this;
f7eb47b… lmata 339 this._entries.push(test);
f7eb47b… lmata 340 }
f7eb47b… lmata 341 _addSuite(suite) {
f7eb47b… lmata 342 suite.parent = this;
f7eb47b… lmata 343 this._entries.push(suite);
f7eb47b… lmata 344 }
f7eb47b… lmata 345 }
f7eb47b… lmata 346 class TeleTestCase {
f7eb47b… lmata 347 constructor(id, title, location, repeatEachIndex) {
f7eb47b… lmata 348 this.fn = () => {
f7eb47b… lmata 349 };
f7eb47b… lmata 350 this.results = [];
f7eb47b… lmata 351 this.type = "test";
f7eb47b… lmata 352 this.expectedStatus = "passed";
f7eb47b… lmata 353 this.timeout = 0;
f7eb47b… lmata 354 this.annotations = [];
f7eb47b… lmata 355 this.retries = 0;
f7eb47b… lmata 356 this.tags = [];
f7eb47b… lmata 357 this.repeatEachIndex = 0;
f7eb47b… lmata 358 this.id = id;
f7eb47b… lmata 359 this.title = title;
f7eb47b… lmata 360 this.location = location;
f7eb47b… lmata 361 this.repeatEachIndex = repeatEachIndex;
f7eb47b… lmata 362 }
f7eb47b… lmata 363 titlePath() {
f7eb47b… lmata 364 const titlePath = this.parent ? this.parent.titlePath() : [];
f7eb47b… lmata 365 titlePath.push(this.title);
f7eb47b… lmata 366 return titlePath;
f7eb47b… lmata 367 }
f7eb47b… lmata 368 outcome() {
f7eb47b… lmata 369 return computeTestCaseOutcome(this);
f7eb47b… lmata 370 }
f7eb47b… lmata 371 ok() {
f7eb47b… lmata 372 const status = this.outcome();
f7eb47b… lmata 373 return status === "expected" || status === "flaky" || status === "skipped";
f7eb47b… lmata 374 }
f7eb47b… lmata 375 _createTestResult(id) {
f7eb47b… lmata 376 const result = new TeleTestResult(this.results.length, id);
f7eb47b… lmata 377 this.results.push(result);
f7eb47b… lmata 378 return result;
f7eb47b… lmata 379 }
f7eb47b… lmata 380 }
f7eb47b… lmata 381 class TeleTestStep {
f7eb47b… lmata 382 constructor(payload, parentStep, location, result) {
f7eb47b… lmata 383 this.duration = -1;
f7eb47b… lmata 384 this.steps = [];
f7eb47b… lmata 385 this._startTime = 0;
f7eb47b… lmata 386 this.title = payload.title;
f7eb47b… lmata 387 this.category = payload.category;
f7eb47b… lmata 388 this.location = location;
f7eb47b… lmata 389 this.parent = parentStep;
f7eb47b… lmata 390 this._startTime = payload.startTime;
f7eb47b… lmata 391 this._result = result;
f7eb47b… lmata 392 }
f7eb47b… lmata 393 titlePath() {
f7eb47b… lmata 394 const parentPath = this.parent?.titlePath() || [];
f7eb47b… lmata 395 return [...parentPath, this.title];
f7eb47b… lmata 396 }
f7eb47b… lmata 397 get startTime() {
f7eb47b… lmata 398 return new Date(this._startTime);
f7eb47b… lmata 399 }
f7eb47b… lmata 400 set startTime(value) {
f7eb47b… lmata 401 this._startTime = +value;
f7eb47b… lmata 402 }
f7eb47b… lmata 403 get attachments() {
f7eb47b… lmata 404 return this._endPayload?.attachments?.map((index) => this._result.attachments[index]) ?? [];
f7eb47b… lmata 405 }
f7eb47b… lmata 406 get annotations() {
f7eb47b… lmata 407 return this._endPayload?.annotations ?? [];
f7eb47b… lmata 408 }
f7eb47b… lmata 409 }
f7eb47b… lmata 410 class TeleTestResult {
f7eb47b… lmata 411 constructor(retry, id) {
f7eb47b… lmata 412 this.parallelIndex = -1;
f7eb47b… lmata 413 this.workerIndex = -1;
f7eb47b… lmata 414 this.duration = -1;
f7eb47b… lmata 415 this.stdout = [];
f7eb47b… lmata 416 this.stderr = [];
f7eb47b… lmata 417 this.attachments = [];
f7eb47b… lmata 418 this.annotations = [];
f7eb47b… lmata 419 this.status = "skipped";
f7eb47b… lmata 420 this.steps = [];
f7eb47b… lmata 421 this.errors = [];
f7eb47b… lmata 422 this._stepMap = /* @__PURE__ */ new Map();
f7eb47b… lmata 423 this._startTime = 0;
f7eb47b… lmata 424 this.retry = retry;
f7eb47b… lmata 425 this._id = id;
f7eb47b… lmata 426 }
f7eb47b… lmata 427 setStartTimeNumber(startTime) {
f7eb47b… lmata 428 this._startTime = startTime;
f7eb47b… lmata 429 }
f7eb47b… lmata 430 get startTime() {
f7eb47b… lmata 431 return new Date(this._startTime);
f7eb47b… lmata 432 }
f7eb47b… lmata 433 set startTime(value) {
f7eb47b… lmata 434 this._startTime = +value;
f7eb47b… lmata 435 }
f7eb47b… lmata 436 }
f7eb47b… lmata 437 const baseFullConfig = {
f7eb47b… lmata 438 forbidOnly: false,
f7eb47b… lmata 439 fullyParallel: false,
f7eb47b… lmata 440 globalSetup: null,
f7eb47b… lmata 441 globalTeardown: null,
f7eb47b… lmata 442 globalTimeout: 0,
f7eb47b… lmata 443 grep: /.*/,
f7eb47b… lmata 444 grepInvert: null,
f7eb47b… lmata 445 maxFailures: 0,
f7eb47b… lmata 446 metadata: {},
f7eb47b… lmata 447 preserveOutput: "always",
f7eb47b… lmata 448 projects: [],
f7eb47b… lmata 449 reporter: [[process.env.CI ? "dot" : "list"]],
f7eb47b… lmata 450 reportSlowTests: {
f7eb47b… lmata 451 max: 5,
f7eb47b… lmata 452 threshold: 3e5
f7eb47b… lmata 453 /* 5 minutes */
f7eb47b… lmata 454 },
f7eb47b… lmata 455 configFile: "",
f7eb47b… lmata 456 rootDir: "",
f7eb47b… lmata 457 quiet: false,
f7eb47b… lmata 458 shard: null,
f7eb47b… lmata 459 tags: [],
f7eb47b… lmata 460 updateSnapshots: "missing",
f7eb47b… lmata 461 updateSourceMethod: "patch",
f7eb47b… lmata 462 // @ts-expect-error runAgents is hidden
f7eb47b… lmata 463 runAgents: "none",
f7eb47b… lmata 464 version: "",
f7eb47b… lmata 465 workers: 0,
f7eb47b… lmata 466 webServer: null
f7eb47b… lmata 467 };
f7eb47b… lmata 468 function serializeRegexPatterns(patterns) {
f7eb47b… lmata 469 if (!Array.isArray(patterns))
f7eb47b… lmata 470 patterns = [patterns];
f7eb47b… lmata 471 return patterns.map((s) => {
f7eb47b… lmata 472 if (typeof s === "string")
f7eb47b… lmata 473 return { s };
f7eb47b… lmata 474 return { r: { source: s.source, flags: s.flags } };
f7eb47b… lmata 475 });
f7eb47b… lmata 476 }
f7eb47b… lmata 477 function parseRegexPatterns(patterns) {
f7eb47b… lmata 478 return patterns.map((p) => {
f7eb47b… lmata 479 if (p.s !== void 0)
f7eb47b… lmata 480 return p.s;
f7eb47b… lmata 481 return new RegExp(p.r.source, p.r.flags);
f7eb47b… lmata 482 });
f7eb47b… lmata 483 }
f7eb47b… lmata 484 function computeTestCaseOutcome(test) {
f7eb47b… lmata 485 let skipped = 0;
f7eb47b… lmata 486 let didNotRun = 0;
f7eb47b… lmata 487 let expected = 0;
f7eb47b… lmata 488 let interrupted = 0;
f7eb47b… lmata 489 let unexpected = 0;
f7eb47b… lmata 490 for (const result of test.results) {
f7eb47b… lmata 491 if (result.status === "interrupted") {
f7eb47b… lmata 492 ++interrupted;
f7eb47b… lmata 493 } else if (result.status === "skipped" && test.expectedStatus === "skipped") {
f7eb47b… lmata 494 ++skipped;
f7eb47b… lmata 495 } else if (result.status === "skipped") {
f7eb47b… lmata 496 ++didNotRun;
f7eb47b… lmata 497 } else if (result.status === test.expectedStatus) {
f7eb47b… lmata 498 ++expected;
f7eb47b… lmata 499 } else {
f7eb47b… lmata 500 ++unexpected;
f7eb47b… lmata 501 }
f7eb47b… lmata 502 }
f7eb47b… lmata 503 if (expected === 0 && unexpected === 0)
f7eb47b… lmata 504 return "skipped";
f7eb47b… lmata 505 if (unexpected === 0)
f7eb47b… lmata 506 return "expected";
f7eb47b… lmata 507 if (expected === 0 && skipped === 0)
f7eb47b… lmata 508 return "unexpected";
f7eb47b… lmata 509 return "flaky";
f7eb47b… lmata 510 }
f7eb47b… lmata 511 // Annotate the CommonJS export names for ESM import in node:
f7eb47b… lmata 512 0 && (module.exports = {
f7eb47b… lmata 513 TeleReporterReceiver,
f7eb47b… lmata 514 TeleSuite,
f7eb47b… lmata 515 TeleTestCase,
f7eb47b… lmata 516 TeleTestResult,
f7eb47b… lmata 517 baseFullConfig,
f7eb47b… lmata 518 computeTestCaseOutcome,
f7eb47b… lmata 519 parseRegexPatterns,
f7eb47b… lmata 520 serializeRegexPatterns
f7eb47b… lmata 521 });

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button