@ohos-ports/playwright 1.52.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +168 -0
  4. package/ThirdPartyNotices.txt +4011 -0
  5. package/cli.js +19 -0
  6. package/index.d.ts +17 -0
  7. package/index.js +17 -0
  8. package/index.mjs +18 -0
  9. package/jsx-runtime.js +42 -0
  10. package/jsx-runtime.mjs +21 -0
  11. package/lib/common/config.js +272 -0
  12. package/lib/common/configLoader.js +373 -0
  13. package/lib/common/esmLoaderHost.js +100 -0
  14. package/lib/common/expectBundle.js +49 -0
  15. package/lib/common/expectBundleImpl.js +389 -0
  16. package/lib/common/fixtures.js +302 -0
  17. package/lib/common/globals.js +58 -0
  18. package/lib/common/ipc.js +60 -0
  19. package/lib/common/poolBuilder.js +85 -0
  20. package/lib/common/process.js +109 -0
  21. package/lib/common/suiteUtils.js +149 -0
  22. package/lib/common/test.js +313 -0
  23. package/lib/common/testLoader.js +100 -0
  24. package/lib/common/testType.js +306 -0
  25. package/lib/errorContext.js +149 -0
  26. package/lib/fsWatcher.js +67 -0
  27. package/lib/index.js +692 -0
  28. package/lib/internalsForTest.js +42 -0
  29. package/lib/isomorphic/events.js +77 -0
  30. package/lib/isomorphic/folders.js +30 -0
  31. package/lib/isomorphic/stringInternPool.js +69 -0
  32. package/lib/isomorphic/teleReceiver.js +484 -0
  33. package/lib/isomorphic/teleSuiteUpdater.js +137 -0
  34. package/lib/isomorphic/testServerConnection.js +211 -0
  35. package/lib/isomorphic/testServerInterface.js +16 -0
  36. package/lib/isomorphic/testTree.js +307 -0
  37. package/lib/isomorphic/types.d.js +16 -0
  38. package/lib/isomorphic/util.js +28 -0
  39. package/lib/loader/loaderMain.js +59 -0
  40. package/lib/matchers/expect.js +322 -0
  41. package/lib/matchers/matcherHint.js +59 -0
  42. package/lib/matchers/matchers.js +362 -0
  43. package/lib/matchers/toBeTruthy.js +71 -0
  44. package/lib/matchers/toEqual.js +94 -0
  45. package/lib/matchers/toHaveURL.js +117 -0
  46. package/lib/matchers/toMatchAriaSnapshot.js +180 -0
  47. package/lib/matchers/toMatchSnapshot.js +365 -0
  48. package/lib/matchers/toMatchText.js +105 -0
  49. package/lib/plugins/gitCommitInfoPlugin.js +198 -0
  50. package/lib/plugins/index.js +28 -0
  51. package/lib/plugins/webServerPlugin.js +207 -0
  52. package/lib/program.js +407 -0
  53. package/lib/reporters/base.js +540 -0
  54. package/lib/reporters/blob.js +135 -0
  55. package/lib/reporters/dot.js +82 -0
  56. package/lib/reporters/empty.js +32 -0
  57. package/lib/reporters/github.js +127 -0
  58. package/lib/reporters/html.js +579 -0
  59. package/lib/reporters/internalReporter.js +129 -0
  60. package/lib/reporters/json.js +254 -0
  61. package/lib/reporters/junit.js +230 -0
  62. package/lib/reporters/line.js +113 -0
  63. package/lib/reporters/list.js +228 -0
  64. package/lib/reporters/merge.js +511 -0
  65. package/lib/reporters/multiplexer.js +104 -0
  66. package/lib/reporters/reporterV2.js +102 -0
  67. package/lib/reporters/teleEmitter.js +269 -0
  68. package/lib/reporters/versions/blobV1.js +16 -0
  69. package/lib/runner/dispatcher.js +484 -0
  70. package/lib/runner/failureTracker.js +62 -0
  71. package/lib/runner/lastRun.js +74 -0
  72. package/lib/runner/loadUtils.js +299 -0
  73. package/lib/runner/loaderHost.js +89 -0
  74. package/lib/runner/processHost.js +165 -0
  75. package/lib/runner/projectUtils.js +235 -0
  76. package/lib/runner/rebase.js +189 -0
  77. package/lib/runner/reporters.js +162 -0
  78. package/lib/runner/runner.js +110 -0
  79. package/lib/runner/sigIntWatcher.js +96 -0
  80. package/lib/runner/taskRunner.js +127 -0
  81. package/lib/runner/tasks.js +400 -0
  82. package/lib/runner/testGroups.js +117 -0
  83. package/lib/runner/testServer.js +477 -0
  84. package/lib/runner/uiModeReporter.js +30 -0
  85. package/lib/runner/vcs.js +72 -0
  86. package/lib/runner/watchMode.js +394 -0
  87. package/lib/runner/workerHost.js +93 -0
  88. package/lib/third_party/tsconfig-loader.js +103 -0
  89. package/lib/transform/babelBundle.js +43 -0
  90. package/lib/transform/babelBundleImpl.js +477 -0
  91. package/lib/transform/compilationCache.js +255 -0
  92. package/lib/transform/esmLoader.js +104 -0
  93. package/lib/transform/esmUtils.js +53 -0
  94. package/lib/transform/portTransport.js +66 -0
  95. package/lib/transform/transform.js +291 -0
  96. package/lib/util.js +407 -0
  97. package/lib/utilsBundle.js +46 -0
  98. package/lib/utilsBundleImpl.js +102 -0
  99. package/lib/worker/fixtureRunner.js +253 -0
  100. package/lib/worker/testInfo.js +422 -0
  101. package/lib/worker/testTracing.js +351 -0
  102. package/lib/worker/timeoutManager.js +174 -0
  103. package/lib/worker/util.js +31 -0
  104. package/lib/worker/workerMain.js +511 -0
  105. package/package.json +64 -0
  106. package/test.d.ts +18 -0
  107. package/test.js +24 -0
  108. package/test.mjs +33 -0
  109. package/types/test.d.ts +10061 -0
  110. package/types/testReporter.d.ts +799 -0
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var internalsForTest_exports = {};
30
+ __export(internalsForTest_exports, {
31
+ fileDependencies: () => fileDependencies
32
+ });
33
+ module.exports = __toCommonJS(internalsForTest_exports);
34
+ var import_path = __toESM(require("path"));
35
+ var import_compilationCache = require("./transform/compilationCache");
36
+ function fileDependencies() {
37
+ return Object.fromEntries([...(0, import_compilationCache.fileDependenciesForTest)().entries()].map((entry) => [import_path.default.basename(entry[0]), [...entry[1]].map((f) => import_path.default.basename(f)).sort()]));
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ fileDependencies
42
+ });
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var events_exports = {};
20
+ __export(events_exports, {
21
+ Disposable: () => Disposable,
22
+ EventEmitter: () => EventEmitter
23
+ });
24
+ module.exports = __toCommonJS(events_exports);
25
+ var Disposable;
26
+ ((Disposable2) => {
27
+ function disposeAll(disposables) {
28
+ for (const disposable of disposables.splice(0))
29
+ disposable.dispose();
30
+ }
31
+ Disposable2.disposeAll = disposeAll;
32
+ })(Disposable || (Disposable = {}));
33
+ class EventEmitter {
34
+ constructor() {
35
+ this._listeners = /* @__PURE__ */ new Set();
36
+ this.event = (listener, disposables) => {
37
+ this._listeners.add(listener);
38
+ let disposed = false;
39
+ const self = this;
40
+ const result = {
41
+ dispose() {
42
+ if (!disposed) {
43
+ disposed = true;
44
+ self._listeners.delete(listener);
45
+ }
46
+ }
47
+ };
48
+ if (disposables)
49
+ disposables.push(result);
50
+ return result;
51
+ };
52
+ }
53
+ fire(event) {
54
+ const dispatch = !this._deliveryQueue;
55
+ if (!this._deliveryQueue)
56
+ this._deliveryQueue = [];
57
+ for (const listener of this._listeners)
58
+ this._deliveryQueue.push({ listener, event });
59
+ if (!dispatch)
60
+ return;
61
+ for (let index = 0; index < this._deliveryQueue.length; index++) {
62
+ const { listener, event: event2 } = this._deliveryQueue[index];
63
+ listener.call(null, event2);
64
+ }
65
+ this._deliveryQueue = void 0;
66
+ }
67
+ dispose() {
68
+ this._listeners.clear();
69
+ if (this._deliveryQueue)
70
+ this._deliveryQueue = [];
71
+ }
72
+ }
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ Disposable,
76
+ EventEmitter
77
+ });
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var folders_exports = {};
20
+ __export(folders_exports, {
21
+ artifactsFolderName: () => artifactsFolderName
22
+ });
23
+ module.exports = __toCommonJS(folders_exports);
24
+ function artifactsFolderName(workerIndex) {
25
+ return `.playwright-artifacts-${workerIndex}`;
26
+ }
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ artifactsFolderName
30
+ });
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var stringInternPool_exports = {};
20
+ __export(stringInternPool_exports, {
21
+ JsonStringInternalizer: () => JsonStringInternalizer,
22
+ StringInternPool: () => StringInternPool
23
+ });
24
+ module.exports = __toCommonJS(stringInternPool_exports);
25
+ class StringInternPool {
26
+ constructor() {
27
+ this._stringCache = /* @__PURE__ */ new Map();
28
+ }
29
+ internString(s) {
30
+ let result = this._stringCache.get(s);
31
+ if (!result) {
32
+ this._stringCache.set(s, s);
33
+ result = s;
34
+ }
35
+ return result;
36
+ }
37
+ }
38
+ class JsonStringInternalizer {
39
+ constructor(pool) {
40
+ this._pool = pool;
41
+ }
42
+ traverse(value) {
43
+ if (typeof value !== "object")
44
+ return;
45
+ if (Array.isArray(value)) {
46
+ for (let i = 0; i < value.length; i++) {
47
+ if (typeof value[i] === "string")
48
+ value[i] = this.intern(value[i]);
49
+ else
50
+ this.traverse(value[i]);
51
+ }
52
+ } else {
53
+ for (const name in value) {
54
+ if (typeof value[name] === "string")
55
+ value[name] = this.intern(value[name]);
56
+ else
57
+ this.traverse(value[name]);
58
+ }
59
+ }
60
+ }
61
+ intern(value) {
62
+ return this._pool.internString(value);
63
+ }
64
+ }
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ JsonStringInternalizer,
68
+ StringInternPool
69
+ });
@@ -0,0 +1,484 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var teleReceiver_exports = {};
20
+ __export(teleReceiver_exports, {
21
+ TeleReporterReceiver: () => TeleReporterReceiver,
22
+ TeleSuite: () => TeleSuite,
23
+ TeleTestCase: () => TeleTestCase,
24
+ TeleTestResult: () => TeleTestResult,
25
+ baseFullConfig: () => baseFullConfig,
26
+ computeTestCaseOutcome: () => computeTestCaseOutcome,
27
+ parseRegexPatterns: () => parseRegexPatterns,
28
+ serializeRegexPatterns: () => serializeRegexPatterns
29
+ });
30
+ module.exports = __toCommonJS(teleReceiver_exports);
31
+ class TeleReporterReceiver {
32
+ constructor(reporter, options = {}) {
33
+ this.isListing = false;
34
+ this._tests = /* @__PURE__ */ new Map();
35
+ this._rootSuite = new TeleSuite("", "root");
36
+ this._options = options;
37
+ this._reporter = reporter;
38
+ }
39
+ reset() {
40
+ this._rootSuite._entries = [];
41
+ this._tests.clear();
42
+ }
43
+ dispatch(message) {
44
+ const { method, params } = message;
45
+ if (method === "onConfigure") {
46
+ this._onConfigure(params.config);
47
+ return;
48
+ }
49
+ if (method === "onProject") {
50
+ this._onProject(params.project);
51
+ return;
52
+ }
53
+ if (method === "onBegin") {
54
+ this._onBegin();
55
+ return;
56
+ }
57
+ if (method === "onTestBegin") {
58
+ this._onTestBegin(params.testId, params.result);
59
+ return;
60
+ }
61
+ if (method === "onTestEnd") {
62
+ this._onTestEnd(params.test, params.result);
63
+ return;
64
+ }
65
+ if (method === "onStepBegin") {
66
+ this._onStepBegin(params.testId, params.resultId, params.step);
67
+ return;
68
+ }
69
+ if (method === "onStepEnd") {
70
+ this._onStepEnd(params.testId, params.resultId, params.step);
71
+ return;
72
+ }
73
+ if (method === "onError") {
74
+ this._onError(params.error);
75
+ return;
76
+ }
77
+ if (method === "onStdIO") {
78
+ this._onStdIO(params.type, params.testId, params.resultId, params.data, params.isBase64);
79
+ return;
80
+ }
81
+ if (method === "onEnd")
82
+ return this._onEnd(params.result);
83
+ if (method === "onExit")
84
+ return this._onExit();
85
+ }
86
+ _onConfigure(config) {
87
+ this._rootDir = config.rootDir;
88
+ this._config = this._parseConfig(config);
89
+ this._reporter.onConfigure?.(this._config);
90
+ }
91
+ _onProject(project) {
92
+ let projectSuite = this._options.mergeProjects ? this._rootSuite.suites.find((suite) => suite.project().name === project.name) : void 0;
93
+ if (!projectSuite) {
94
+ projectSuite = new TeleSuite(project.name, "project");
95
+ this._rootSuite._addSuite(projectSuite);
96
+ }
97
+ projectSuite._project = this._parseProject(project);
98
+ for (const suite of project.suites)
99
+ this._mergeSuiteInto(suite, projectSuite);
100
+ }
101
+ _onBegin() {
102
+ this._reporter.onBegin?.(this._rootSuite);
103
+ }
104
+ _onTestBegin(testId, payload) {
105
+ const test = this._tests.get(testId);
106
+ if (this._options.clearPreviousResultsWhenTestBegins)
107
+ test.results = [];
108
+ const testResult = test._createTestResult(payload.id);
109
+ testResult.retry = payload.retry;
110
+ testResult.workerIndex = payload.workerIndex;
111
+ testResult.parallelIndex = payload.parallelIndex;
112
+ testResult.setStartTimeNumber(payload.startTime);
113
+ this._reporter.onTestBegin?.(test, testResult);
114
+ }
115
+ _onTestEnd(testEndPayload, payload) {
116
+ const test = this._tests.get(testEndPayload.testId);
117
+ test.timeout = testEndPayload.timeout;
118
+ test.expectedStatus = testEndPayload.expectedStatus;
119
+ const result = test.results.find((r) => r._id === payload.id);
120
+ result.duration = payload.duration;
121
+ result.status = payload.status;
122
+ result.errors = payload.errors;
123
+ result.error = result.errors?.[0];
124
+ result.attachments = this._parseAttachments(payload.attachments);
125
+ if (payload.annotations) {
126
+ result.annotations = payload.annotations;
127
+ test.annotations = result.annotations;
128
+ }
129
+ this._reporter.onTestEnd?.(test, result);
130
+ result._stepMap = /* @__PURE__ */ new Map();
131
+ }
132
+ _onStepBegin(testId, resultId, payload) {
133
+ const test = this._tests.get(testId);
134
+ const result = test.results.find((r) => r._id === resultId);
135
+ const parentStep = payload.parentStepId ? result._stepMap.get(payload.parentStepId) : void 0;
136
+ const location = this._absoluteLocation(payload.location);
137
+ const step = new TeleTestStep(payload, parentStep, location, result);
138
+ if (parentStep)
139
+ parentStep.steps.push(step);
140
+ else
141
+ result.steps.push(step);
142
+ result._stepMap.set(payload.id, step);
143
+ this._reporter.onStepBegin?.(test, result, step);
144
+ }
145
+ _onStepEnd(testId, resultId, payload) {
146
+ const test = this._tests.get(testId);
147
+ const result = test.results.find((r) => r._id === resultId);
148
+ const step = result._stepMap.get(payload.id);
149
+ step._endPayload = payload;
150
+ step.duration = payload.duration;
151
+ step.error = payload.error;
152
+ this._reporter.onStepEnd?.(test, result, step);
153
+ }
154
+ _onError(error) {
155
+ this._reporter.onError?.(error);
156
+ }
157
+ _onStdIO(type, testId, resultId, data, isBase64) {
158
+ const chunk = isBase64 ? globalThis.Buffer ? Buffer.from(data, "base64") : atob(data) : data;
159
+ const test = testId ? this._tests.get(testId) : void 0;
160
+ const result = test && resultId ? test.results.find((r) => r._id === resultId) : void 0;
161
+ if (type === "stdout") {
162
+ result?.stdout.push(chunk);
163
+ this._reporter.onStdOut?.(chunk, test, result);
164
+ } else {
165
+ result?.stderr.push(chunk);
166
+ this._reporter.onStdErr?.(chunk, test, result);
167
+ }
168
+ }
169
+ async _onEnd(result) {
170
+ await this._reporter.onEnd?.({
171
+ status: result.status,
172
+ startTime: new Date(result.startTime),
173
+ duration: result.duration
174
+ });
175
+ }
176
+ _onExit() {
177
+ return this._reporter.onExit?.();
178
+ }
179
+ _parseConfig(config) {
180
+ const result = { ...baseFullConfig, ...config };
181
+ if (this._options.configOverrides) {
182
+ result.configFile = this._options.configOverrides.configFile;
183
+ result.reportSlowTests = this._options.configOverrides.reportSlowTests;
184
+ result.quiet = this._options.configOverrides.quiet;
185
+ result.reporter = [...this._options.configOverrides.reporter];
186
+ }
187
+ return result;
188
+ }
189
+ _parseProject(project) {
190
+ return {
191
+ metadata: project.metadata,
192
+ name: project.name,
193
+ outputDir: this._absolutePath(project.outputDir),
194
+ repeatEach: project.repeatEach,
195
+ retries: project.retries,
196
+ testDir: this._absolutePath(project.testDir),
197
+ testIgnore: parseRegexPatterns(project.testIgnore),
198
+ testMatch: parseRegexPatterns(project.testMatch),
199
+ timeout: project.timeout,
200
+ grep: parseRegexPatterns(project.grep),
201
+ grepInvert: parseRegexPatterns(project.grepInvert),
202
+ dependencies: project.dependencies,
203
+ teardown: project.teardown,
204
+ snapshotDir: this._absolutePath(project.snapshotDir),
205
+ use: project.use
206
+ };
207
+ }
208
+ _parseAttachments(attachments) {
209
+ return attachments.map((a) => {
210
+ return {
211
+ ...a,
212
+ body: a.base64 && globalThis.Buffer ? Buffer.from(a.base64, "base64") : void 0
213
+ };
214
+ });
215
+ }
216
+ _mergeSuiteInto(jsonSuite, parent) {
217
+ let targetSuite = parent.suites.find((s) => s.title === jsonSuite.title);
218
+ if (!targetSuite) {
219
+ targetSuite = new TeleSuite(jsonSuite.title, parent.type === "project" ? "file" : "describe");
220
+ parent._addSuite(targetSuite);
221
+ }
222
+ targetSuite.location = this._absoluteLocation(jsonSuite.location);
223
+ jsonSuite.entries.forEach((e) => {
224
+ if ("testId" in e)
225
+ this._mergeTestInto(e, targetSuite);
226
+ else
227
+ this._mergeSuiteInto(e, targetSuite);
228
+ });
229
+ }
230
+ _mergeTestInto(jsonTest, parent) {
231
+ let targetTest = this._options.mergeTestCases ? parent.tests.find((s) => s.title === jsonTest.title && s.repeatEachIndex === jsonTest.repeatEachIndex) : void 0;
232
+ if (!targetTest) {
233
+ targetTest = new TeleTestCase(jsonTest.testId, jsonTest.title, this._absoluteLocation(jsonTest.location), jsonTest.repeatEachIndex);
234
+ parent._addTest(targetTest);
235
+ this._tests.set(targetTest.id, targetTest);
236
+ }
237
+ this._updateTest(jsonTest, targetTest);
238
+ }
239
+ _updateTest(payload, test) {
240
+ test.id = payload.testId;
241
+ test.location = this._absoluteLocation(payload.location);
242
+ test.retries = payload.retries;
243
+ test.tags = payload.tags ?? [];
244
+ test.annotations = payload.annotations ?? [];
245
+ return test;
246
+ }
247
+ _absoluteLocation(location) {
248
+ if (!location)
249
+ return location;
250
+ return {
251
+ ...location,
252
+ file: this._absolutePath(location.file)
253
+ };
254
+ }
255
+ _absolutePath(relativePath) {
256
+ if (relativePath === void 0)
257
+ return;
258
+ return this._options.resolvePath ? this._options.resolvePath(this._rootDir, relativePath) : this._rootDir + "/" + relativePath;
259
+ }
260
+ }
261
+ class TeleSuite {
262
+ constructor(title, type) {
263
+ this._entries = [];
264
+ this._requireFile = "";
265
+ this._parallelMode = "none";
266
+ this.title = title;
267
+ this._type = type;
268
+ }
269
+ get type() {
270
+ return this._type;
271
+ }
272
+ get suites() {
273
+ return this._entries.filter((e) => e.type !== "test");
274
+ }
275
+ get tests() {
276
+ return this._entries.filter((e) => e.type === "test");
277
+ }
278
+ entries() {
279
+ return this._entries;
280
+ }
281
+ allTests() {
282
+ const result = [];
283
+ const visit = (suite) => {
284
+ for (const entry of suite.entries()) {
285
+ if (entry.type === "test")
286
+ result.push(entry);
287
+ else
288
+ visit(entry);
289
+ }
290
+ };
291
+ visit(this);
292
+ return result;
293
+ }
294
+ titlePath() {
295
+ const titlePath = this.parent ? this.parent.titlePath() : [];
296
+ if (this.title || this._type !== "describe")
297
+ titlePath.push(this.title);
298
+ return titlePath;
299
+ }
300
+ project() {
301
+ return this._project ?? this.parent?.project();
302
+ }
303
+ _addTest(test) {
304
+ test.parent = this;
305
+ this._entries.push(test);
306
+ }
307
+ _addSuite(suite) {
308
+ suite.parent = this;
309
+ this._entries.push(suite);
310
+ }
311
+ }
312
+ class TeleTestCase {
313
+ constructor(id, title, location, repeatEachIndex) {
314
+ this.fn = () => {
315
+ };
316
+ this.results = [];
317
+ this.type = "test";
318
+ this.expectedStatus = "passed";
319
+ this.timeout = 0;
320
+ this.annotations = [];
321
+ this.retries = 0;
322
+ this.tags = [];
323
+ this.repeatEachIndex = 0;
324
+ this.id = id;
325
+ this.title = title;
326
+ this.location = location;
327
+ this.repeatEachIndex = repeatEachIndex;
328
+ }
329
+ titlePath() {
330
+ const titlePath = this.parent ? this.parent.titlePath() : [];
331
+ titlePath.push(this.title);
332
+ return titlePath;
333
+ }
334
+ outcome() {
335
+ return computeTestCaseOutcome(this);
336
+ }
337
+ ok() {
338
+ const status = this.outcome();
339
+ return status === "expected" || status === "flaky" || status === "skipped";
340
+ }
341
+ _createTestResult(id) {
342
+ const result = new TeleTestResult(this.results.length, id);
343
+ this.results.push(result);
344
+ return result;
345
+ }
346
+ }
347
+ class TeleTestStep {
348
+ constructor(payload, parentStep, location, result) {
349
+ this.duration = -1;
350
+ this.steps = [];
351
+ this._startTime = 0;
352
+ this.title = payload.title;
353
+ this.category = payload.category;
354
+ this.location = location;
355
+ this.parent = parentStep;
356
+ this._startTime = payload.startTime;
357
+ this._result = result;
358
+ }
359
+ titlePath() {
360
+ const parentPath = this.parent?.titlePath() || [];
361
+ return [...parentPath, this.title];
362
+ }
363
+ get startTime() {
364
+ return new Date(this._startTime);
365
+ }
366
+ set startTime(value) {
367
+ this._startTime = +value;
368
+ }
369
+ get attachments() {
370
+ return this._endPayload?.attachments?.map((index) => this._result.attachments[index]) ?? [];
371
+ }
372
+ get annotations() {
373
+ return this._endPayload?.annotations ?? [];
374
+ }
375
+ }
376
+ class TeleTestResult {
377
+ constructor(retry, id) {
378
+ this.parallelIndex = -1;
379
+ this.workerIndex = -1;
380
+ this.duration = -1;
381
+ this.stdout = [];
382
+ this.stderr = [];
383
+ this.attachments = [];
384
+ this.annotations = [];
385
+ this.status = "skipped";
386
+ this.steps = [];
387
+ this.errors = [];
388
+ this._stepMap = /* @__PURE__ */ new Map();
389
+ this._startTime = 0;
390
+ this.retry = retry;
391
+ this._id = id;
392
+ }
393
+ setStartTimeNumber(startTime) {
394
+ this._startTime = startTime;
395
+ }
396
+ get startTime() {
397
+ return new Date(this._startTime);
398
+ }
399
+ set startTime(value) {
400
+ this._startTime = +value;
401
+ }
402
+ }
403
+ const baseFullConfig = {
404
+ forbidOnly: false,
405
+ fullyParallel: false,
406
+ globalSetup: null,
407
+ globalTeardown: null,
408
+ globalTimeout: 0,
409
+ grep: /.*/,
410
+ grepInvert: null,
411
+ maxFailures: 0,
412
+ metadata: {},
413
+ preserveOutput: "always",
414
+ projects: [],
415
+ reporter: [[process.env.CI ? "dot" : "list"]],
416
+ reportSlowTests: {
417
+ max: 5,
418
+ threshold: 3e5
419
+ /* 5 minutes */
420
+ },
421
+ configFile: "",
422
+ rootDir: "",
423
+ quiet: false,
424
+ shard: null,
425
+ updateSnapshots: "missing",
426
+ updateSourceMethod: "patch",
427
+ version: "",
428
+ workers: 0,
429
+ webServer: null
430
+ };
431
+ function serializeRegexPatterns(patterns) {
432
+ if (!Array.isArray(patterns))
433
+ patterns = [patterns];
434
+ return patterns.map((s) => {
435
+ if (typeof s === "string")
436
+ return { s };
437
+ return { r: { source: s.source, flags: s.flags } };
438
+ });
439
+ }
440
+ function parseRegexPatterns(patterns) {
441
+ return patterns.map((p) => {
442
+ if (p.s !== void 0)
443
+ return p.s;
444
+ return new RegExp(p.r.source, p.r.flags);
445
+ });
446
+ }
447
+ function computeTestCaseOutcome(test) {
448
+ let skipped = 0;
449
+ let didNotRun = 0;
450
+ let expected = 0;
451
+ let interrupted = 0;
452
+ let unexpected = 0;
453
+ for (const result of test.results) {
454
+ if (result.status === "interrupted") {
455
+ ++interrupted;
456
+ } else if (result.status === "skipped" && test.expectedStatus === "skipped") {
457
+ ++skipped;
458
+ } else if (result.status === "skipped") {
459
+ ++didNotRun;
460
+ } else if (result.status === test.expectedStatus) {
461
+ ++expected;
462
+ } else {
463
+ ++unexpected;
464
+ }
465
+ }
466
+ if (expected === 0 && unexpected === 0)
467
+ return "skipped";
468
+ if (unexpected === 0)
469
+ return "expected";
470
+ if (expected === 0 && skipped === 0)
471
+ return "unexpected";
472
+ return "flaky";
473
+ }
474
+ // Annotate the CommonJS export names for ESM import in node:
475
+ 0 && (module.exports = {
476
+ TeleReporterReceiver,
477
+ TeleSuite,
478
+ TeleTestCase,
479
+ TeleTestResult,
480
+ baseFullConfig,
481
+ computeTestCaseOutcome,
482
+ parseRegexPatterns,
483
+ serializeRegexPatterns
484
+ });