@smoothdeploy/playwright 1.58.4 → 1.60.0-beta-1780662356000

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 (182) hide show
  1. package/ThirdPartyNotices.txt +8 -5036
  2. package/lib/agents/agentParser.js +2 -2
  3. package/lib/agents/generateAgents.js +21 -22
  4. package/lib/agents/playwright-test-healer.agent.md +1 -0
  5. package/lib/agents/playwright-test-planner.agent.md +2 -1
  6. package/lib/cli/reportActions.js +78 -0
  7. package/lib/cli/testActions.js +211 -0
  8. package/lib/common/index.js +2898 -0
  9. package/lib/common/index.js.txt +35 -0
  10. package/lib/errorContext.js +130 -0
  11. package/lib/index.js +258 -206
  12. package/lib/{isomorphic/testServerConnection.js → isomorphic.js} +70 -35
  13. package/lib/isomorphic.js.txt +9 -0
  14. package/lib/loader/loaderProcessEntry.js +34 -0
  15. package/lib/loader/loaderProcessEntry.js.txt +9 -0
  16. package/lib/matchers/expect.js +12988 -249
  17. package/lib/matchers/expect.js.LICENSE +693 -0
  18. package/lib/matchers/expect.js.txt +72 -0
  19. package/lib/mcp/test/browserBackend.js +49 -22
  20. package/lib/mcp/test/generatorTools.js +16 -16
  21. package/lib/mcp/test/plannerTools.js +25 -20
  22. package/lib/mcp/test/seed.js +7 -7
  23. package/lib/mcp/test/testBackend.js +30 -30
  24. package/lib/mcp/test/testContext.js +50 -33
  25. package/lib/mcp/test/testTools.js +15 -25
  26. package/lib/{internalsForTest.js → package.js} +13 -8
  27. package/lib/program.js +63 -263
  28. package/lib/runner/index.js +8339 -0
  29. package/lib/runner/index.js.txt +60 -0
  30. package/lib/transform/babelBundle.js +71002 -18
  31. package/lib/transform/babelBundle.js.LICENSE +2359 -0
  32. package/lib/transform/babelBundle.js.txt +325 -0
  33. package/lib/transform/esmLoader.js +5884 -30
  34. package/lib/transform/esmLoader.js.LICENSE +335 -0
  35. package/lib/transform/esmLoader.js.txt +55 -0
  36. package/lib/util.js +37 -34
  37. package/lib/worker/workerProcessEntry.js +3251 -0
  38. package/lib/worker/workerProcessEntry.js.txt +24 -0
  39. package/package.json +5 -16
  40. package/test.mjs +1 -0
  41. package/types/test.d.ts +172 -12
  42. package/types/testReporter.d.ts +7 -5
  43. package/lib/common/config.js +0 -282
  44. package/lib/common/configLoader.js +0 -344
  45. package/lib/common/esmLoaderHost.js +0 -104
  46. package/lib/common/expectBundle.js +0 -28
  47. package/lib/common/expectBundleImpl.js +0 -407
  48. package/lib/common/fixtures.js +0 -302
  49. package/lib/common/ipc.js +0 -60
  50. package/lib/common/poolBuilder.js +0 -85
  51. package/lib/common/process.js +0 -132
  52. package/lib/common/suiteUtils.js +0 -140
  53. package/lib/common/test.js +0 -321
  54. package/lib/common/testLoader.js +0 -101
  55. package/lib/common/testType.js +0 -298
  56. package/lib/common/validators.js +0 -68
  57. package/lib/fsWatcher.js +0 -67
  58. package/lib/isomorphic/events.js +0 -77
  59. package/lib/isomorphic/folders.js +0 -30
  60. package/lib/isomorphic/stringInternPool.js +0 -69
  61. package/lib/isomorphic/teleReceiver.js +0 -521
  62. package/lib/isomorphic/teleSuiteUpdater.js +0 -157
  63. package/lib/isomorphic/testServerInterface.js +0 -16
  64. package/lib/isomorphic/testTree.js +0 -329
  65. package/lib/isomorphic/types.d.js +0 -16
  66. package/lib/loader/loaderMain.js +0 -59
  67. package/lib/matchers/matcherHint.js +0 -44
  68. package/lib/matchers/matchers.js +0 -383
  69. package/lib/matchers/toBeTruthy.js +0 -75
  70. package/lib/matchers/toEqual.js +0 -100
  71. package/lib/matchers/toHaveURL.js +0 -101
  72. package/lib/matchers/toMatchAriaSnapshot.js +0 -159
  73. package/lib/matchers/toMatchSnapshot.js +0 -342
  74. package/lib/matchers/toMatchText.js +0 -99
  75. package/lib/mcp/browser/browserContextFactory.js +0 -329
  76. package/lib/mcp/browser/browserServerBackend.js +0 -84
  77. package/lib/mcp/browser/config.js +0 -421
  78. package/lib/mcp/browser/context.js +0 -244
  79. package/lib/mcp/browser/response.js +0 -278
  80. package/lib/mcp/browser/sessionLog.js +0 -75
  81. package/lib/mcp/browser/tab.js +0 -343
  82. package/lib/mcp/browser/tools/common.js +0 -65
  83. package/lib/mcp/browser/tools/console.js +0 -46
  84. package/lib/mcp/browser/tools/dialogs.js +0 -60
  85. package/lib/mcp/browser/tools/evaluate.js +0 -61
  86. package/lib/mcp/browser/tools/files.js +0 -58
  87. package/lib/mcp/browser/tools/form.js +0 -63
  88. package/lib/mcp/browser/tools/install.js +0 -72
  89. package/lib/mcp/browser/tools/keyboard.js +0 -107
  90. package/lib/mcp/browser/tools/mouse.js +0 -107
  91. package/lib/mcp/browser/tools/navigate.js +0 -71
  92. package/lib/mcp/browser/tools/network.js +0 -63
  93. package/lib/mcp/browser/tools/open.js +0 -57
  94. package/lib/mcp/browser/tools/pdf.js +0 -49
  95. package/lib/mcp/browser/tools/runCode.js +0 -78
  96. package/lib/mcp/browser/tools/screenshot.js +0 -93
  97. package/lib/mcp/browser/tools/snapshot.js +0 -173
  98. package/lib/mcp/browser/tools/tabs.js +0 -67
  99. package/lib/mcp/browser/tools/tool.js +0 -47
  100. package/lib/mcp/browser/tools/tracing.js +0 -74
  101. package/lib/mcp/browser/tools/utils.js +0 -94
  102. package/lib/mcp/browser/tools/verify.js +0 -143
  103. package/lib/mcp/browser/tools/wait.js +0 -63
  104. package/lib/mcp/browser/tools.js +0 -84
  105. package/lib/mcp/browser/watchdog.js +0 -44
  106. package/lib/mcp/config.d.js +0 -16
  107. package/lib/mcp/extension/cdpRelay.js +0 -351
  108. package/lib/mcp/extension/extensionContextFactory.js +0 -76
  109. package/lib/mcp/extension/protocol.js +0 -28
  110. package/lib/mcp/index.js +0 -61
  111. package/lib/mcp/log.js +0 -35
  112. package/lib/mcp/program.js +0 -111
  113. package/lib/mcp/sdk/exports.js +0 -28
  114. package/lib/mcp/sdk/http.js +0 -152
  115. package/lib/mcp/sdk/inProcessTransport.js +0 -71
  116. package/lib/mcp/sdk/server.js +0 -223
  117. package/lib/mcp/sdk/tool.js +0 -47
  118. package/lib/mcp/terminal/cli.js +0 -296
  119. package/lib/mcp/terminal/command.js +0 -56
  120. package/lib/mcp/terminal/commands.js +0 -333
  121. package/lib/mcp/terminal/daemon.js +0 -129
  122. package/lib/mcp/terminal/help.json +0 -32
  123. package/lib/mcp/terminal/helpGenerator.js +0 -88
  124. package/lib/mcp/terminal/socketConnection.js +0 -80
  125. package/lib/plugins/gitCommitInfoPlugin.js +0 -198
  126. package/lib/plugins/index.js +0 -28
  127. package/lib/plugins/webServerPlugin.js +0 -237
  128. package/lib/reporters/base.js +0 -634
  129. package/lib/reporters/blob.js +0 -138
  130. package/lib/reporters/dot.js +0 -99
  131. package/lib/reporters/empty.js +0 -32
  132. package/lib/reporters/github.js +0 -128
  133. package/lib/reporters/html.js +0 -633
  134. package/lib/reporters/internalReporter.js +0 -138
  135. package/lib/reporters/json.js +0 -254
  136. package/lib/reporters/junit.js +0 -232
  137. package/lib/reporters/line.js +0 -131
  138. package/lib/reporters/list.js +0 -253
  139. package/lib/reporters/listModeReporter.js +0 -69
  140. package/lib/reporters/markdown.js +0 -144
  141. package/lib/reporters/merge.js +0 -558
  142. package/lib/reporters/multiplexer.js +0 -112
  143. package/lib/reporters/reporterV2.js +0 -102
  144. package/lib/reporters/smoothdeploy.js +0 -333
  145. package/lib/reporters/teleEmitter.js +0 -317
  146. package/lib/reporters/versions/blobV1.js +0 -16
  147. package/lib/runner/dispatcher.js +0 -531
  148. package/lib/runner/failureTracker.js +0 -72
  149. package/lib/runner/lastRun.js +0 -77
  150. package/lib/runner/loadUtils.js +0 -334
  151. package/lib/runner/loaderHost.js +0 -89
  152. package/lib/runner/processHost.js +0 -180
  153. package/lib/runner/projectUtils.js +0 -241
  154. package/lib/runner/rebase.js +0 -189
  155. package/lib/runner/reporters.js +0 -140
  156. package/lib/runner/sigIntWatcher.js +0 -96
  157. package/lib/runner/storage.js +0 -91
  158. package/lib/runner/taskRunner.js +0 -127
  159. package/lib/runner/tasks.js +0 -410
  160. package/lib/runner/testGroups.js +0 -125
  161. package/lib/runner/testRunner.js +0 -398
  162. package/lib/runner/testServer.js +0 -269
  163. package/lib/runner/uiModeReporter.js +0 -30
  164. package/lib/runner/vcs.js +0 -72
  165. package/lib/runner/watchMode.js +0 -396
  166. package/lib/runner/workerHost.js +0 -104
  167. package/lib/third_party/pirates.js +0 -62
  168. package/lib/third_party/tsconfig-loader.js +0 -103
  169. package/lib/transform/babelBundleImpl.js +0 -461
  170. package/lib/transform/compilationCache.js +0 -274
  171. package/lib/transform/md.js +0 -221
  172. package/lib/transform/portTransport.js +0 -67
  173. package/lib/transform/transform.js +0 -303
  174. package/lib/utilsBundle.js +0 -50
  175. package/lib/utilsBundleImpl.js +0 -103
  176. package/lib/worker/fixtureRunner.js +0 -262
  177. package/lib/worker/testInfo.js +0 -536
  178. package/lib/worker/testTracing.js +0 -345
  179. package/lib/worker/timeoutManager.js +0 -174
  180. package/lib/worker/util.js +0 -31
  181. package/lib/worker/workerMain.js +0 -530
  182. /package/lib/{common/globals.js → globals.js} +0 -0
@@ -1,140 +0,0 @@
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 suiteUtils_exports = {};
30
- __export(suiteUtils_exports, {
31
- applyRepeatEachIndex: () => applyRepeatEachIndex,
32
- bindFileSuiteToProject: () => bindFileSuiteToProject,
33
- filterByFocusedLine: () => filterByFocusedLine,
34
- filterOnly: () => filterOnly,
35
- filterSuite: () => filterSuite,
36
- filterTestsRemoveEmptySuites: () => filterTestsRemoveEmptySuites
37
- });
38
- module.exports = __toCommonJS(suiteUtils_exports);
39
- var import_path = __toESM(require("path"));
40
- var import_utils = require("playwright-core/lib/utils");
41
- var import_util = require("../util");
42
- function filterSuite(suite, suiteFilter, testFilter) {
43
- for (const child of suite.suites) {
44
- if (!suiteFilter(child))
45
- filterSuite(child, suiteFilter, testFilter);
46
- }
47
- const filteredTests = suite.tests.filter(testFilter);
48
- const entries = /* @__PURE__ */ new Set([...suite.suites, ...filteredTests]);
49
- suite._entries = suite._entries.filter((e) => entries.has(e));
50
- }
51
- function filterTestsRemoveEmptySuites(suite, filter) {
52
- const filteredSuites = suite.suites.filter((child) => filterTestsRemoveEmptySuites(child, filter));
53
- const filteredTests = suite.tests.filter(filter);
54
- const entries = /* @__PURE__ */ new Set([...filteredSuites, ...filteredTests]);
55
- suite._entries = suite._entries.filter((e) => entries.has(e));
56
- return !!suite._entries.length;
57
- }
58
- function bindFileSuiteToProject(project, suite) {
59
- const relativeFile = import_path.default.relative(project.project.testDir, suite.location.file);
60
- const fileId = (0, import_utils.calculateSha1)((0, import_utils.toPosixPath)(relativeFile)).slice(0, 20);
61
- const result = suite._deepClone();
62
- result._fileId = fileId;
63
- result.forEachTest((test, suite2) => {
64
- suite2._fileId = fileId;
65
- const [file, ...titles] = test.titlePath();
66
- const testIdExpression = `[project=${project.id}]${(0, import_utils.toPosixPath)(file)}${titles.join("")}`;
67
- const testId = fileId + "-" + (0, import_utils.calculateSha1)(testIdExpression).slice(0, 20);
68
- test.id = testId;
69
- test._projectId = project.id;
70
- let inheritedRetries;
71
- let inheritedTimeout;
72
- for (let parentSuite = suite2; parentSuite; parentSuite = parentSuite.parent) {
73
- if (parentSuite._staticAnnotations.length)
74
- test.annotations.unshift(...parentSuite._staticAnnotations);
75
- if (inheritedRetries === void 0 && parentSuite._retries !== void 0)
76
- inheritedRetries = parentSuite._retries;
77
- if (inheritedTimeout === void 0 && parentSuite._timeout !== void 0)
78
- inheritedTimeout = parentSuite._timeout;
79
- }
80
- test.retries = inheritedRetries ?? project.project.retries;
81
- test.timeout = inheritedTimeout ?? project.project.timeout;
82
- if (test.annotations.some((a) => a.type === "skip" || a.type === "fixme"))
83
- test.expectedStatus = "skipped";
84
- if (test._poolDigest)
85
- test._workerHash = `${project.id}-${test._poolDigest}-0`;
86
- });
87
- return result;
88
- }
89
- function applyRepeatEachIndex(project, fileSuite, repeatEachIndex) {
90
- fileSuite.forEachTest((test, suite) => {
91
- if (repeatEachIndex) {
92
- const [file, ...titles] = test.titlePath();
93
- const testIdExpression = `[project=${project.id}]${(0, import_utils.toPosixPath)(file)}${titles.join("")} (repeat:${repeatEachIndex})`;
94
- const testId = suite._fileId + "-" + (0, import_utils.calculateSha1)(testIdExpression).slice(0, 20);
95
- test.id = testId;
96
- test.repeatEachIndex = repeatEachIndex;
97
- if (test._poolDigest)
98
- test._workerHash = `${project.id}-${test._poolDigest}-${repeatEachIndex}`;
99
- }
100
- });
101
- }
102
- function filterOnly(suite) {
103
- if (!suite._getOnlyItems().length)
104
- return;
105
- const suiteFilter = (suite2) => suite2._only;
106
- const testFilter = (test) => test._only;
107
- return filterSuiteWithOnlySemantics(suite, suiteFilter, testFilter);
108
- }
109
- function filterSuiteWithOnlySemantics(suite, suiteFilter, testFilter) {
110
- const onlySuites = suite.suites.filter((child) => filterSuiteWithOnlySemantics(child, suiteFilter, testFilter) || suiteFilter(child));
111
- const onlyTests = suite.tests.filter(testFilter);
112
- const onlyEntries = /* @__PURE__ */ new Set([...onlySuites, ...onlyTests]);
113
- if (onlyEntries.size) {
114
- suite._entries = suite._entries.filter((e) => onlyEntries.has(e));
115
- return true;
116
- }
117
- return false;
118
- }
119
- function filterByFocusedLine(suite, focusedTestFileLines) {
120
- if (!focusedTestFileLines.length)
121
- return;
122
- const matchers = focusedTestFileLines.map(createFileMatcherFromFilter);
123
- const testFileLineMatches = (testFileName, testLine, testColumn) => matchers.some((m) => m(testFileName, testLine, testColumn));
124
- const suiteFilter = (suite2) => !!suite2.location && testFileLineMatches(suite2.location.file, suite2.location.line, suite2.location.column);
125
- const testFilter = (test) => testFileLineMatches(test.location.file, test.location.line, test.location.column);
126
- return filterSuite(suite, suiteFilter, testFilter);
127
- }
128
- function createFileMatcherFromFilter(filter) {
129
- const fileMatcher = (0, import_util.createFileMatcher)(filter.re || filter.exact || "");
130
- return (testFileName, testLine, testColumn) => fileMatcher(testFileName) && (filter.line === testLine || filter.line === null) && (filter.column === testColumn || filter.column === null);
131
- }
132
- // Annotate the CommonJS export names for ESM import in node:
133
- 0 && (module.exports = {
134
- applyRepeatEachIndex,
135
- bindFileSuiteToProject,
136
- filterByFocusedLine,
137
- filterOnly,
138
- filterSuite,
139
- filterTestsRemoveEmptySuites
140
- });
@@ -1,321 +0,0 @@
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 test_exports = {};
20
- __export(test_exports, {
21
- Suite: () => Suite,
22
- TestCase: () => TestCase
23
- });
24
- module.exports = __toCommonJS(test_exports);
25
- var import_testType = require("./testType");
26
- var import_teleReceiver = require("../isomorphic/teleReceiver");
27
- class Base {
28
- constructor(title) {
29
- this._only = false;
30
- this._requireFile = "";
31
- this.title = title;
32
- }
33
- }
34
- class Suite extends Base {
35
- constructor(title, type) {
36
- super(title);
37
- this._use = [];
38
- this._entries = [];
39
- this._hooks = [];
40
- // Annotations known statically before running the test, e.g. `test.describe.skip()` or `test.describe({ annotation }, body)`.
41
- this._staticAnnotations = [];
42
- // Explicitly declared tags that are not a part of the title.
43
- this._tags = [];
44
- this._modifiers = [];
45
- this._parallelMode = "none";
46
- this._type = type;
47
- }
48
- get type() {
49
- return this._type;
50
- }
51
- entries() {
52
- return this._entries;
53
- }
54
- get suites() {
55
- return this._entries.filter((entry) => entry instanceof Suite);
56
- }
57
- get tests() {
58
- return this._entries.filter((entry) => entry instanceof TestCase);
59
- }
60
- _addTest(test) {
61
- test.parent = this;
62
- this._entries.push(test);
63
- }
64
- _addSuite(suite) {
65
- suite.parent = this;
66
- this._entries.push(suite);
67
- }
68
- _prependSuite(suite) {
69
- suite.parent = this;
70
- this._entries.unshift(suite);
71
- }
72
- allTests() {
73
- const result = [];
74
- const visit = (suite) => {
75
- for (const entry of suite._entries) {
76
- if (entry instanceof Suite)
77
- visit(entry);
78
- else
79
- result.push(entry);
80
- }
81
- };
82
- visit(this);
83
- return result;
84
- }
85
- _hasTests() {
86
- let result = false;
87
- const visit = (suite) => {
88
- for (const entry of suite._entries) {
89
- if (result)
90
- return;
91
- if (entry instanceof Suite)
92
- visit(entry);
93
- else
94
- result = true;
95
- }
96
- };
97
- visit(this);
98
- return result;
99
- }
100
- titlePath() {
101
- const titlePath = this.parent ? this.parent.titlePath() : [];
102
- if (this.title || this._type !== "describe")
103
- titlePath.push(this.title);
104
- return titlePath;
105
- }
106
- _collectGrepTitlePath(path) {
107
- if (this.parent)
108
- this.parent._collectGrepTitlePath(path);
109
- if (this.title || this._type !== "describe")
110
- path.push(this.title);
111
- path.push(...this._tags);
112
- }
113
- _getOnlyItems() {
114
- const items = [];
115
- if (this._only)
116
- items.push(this);
117
- for (const suite of this.suites)
118
- items.push(...suite._getOnlyItems());
119
- items.push(...this.tests.filter((test) => test._only));
120
- return items;
121
- }
122
- _deepClone() {
123
- const suite = this._clone();
124
- for (const entry of this._entries) {
125
- if (entry instanceof Suite)
126
- suite._addSuite(entry._deepClone());
127
- else
128
- suite._addTest(entry._clone());
129
- }
130
- return suite;
131
- }
132
- _deepSerialize() {
133
- const suite = this._serialize();
134
- suite.entries = [];
135
- for (const entry of this._entries) {
136
- if (entry instanceof Suite)
137
- suite.entries.push(entry._deepSerialize());
138
- else
139
- suite.entries.push(entry._serialize());
140
- }
141
- return suite;
142
- }
143
- static _deepParse(data) {
144
- const suite = Suite._parse(data);
145
- for (const entry of data.entries) {
146
- if (entry.kind === "suite")
147
- suite._addSuite(Suite._deepParse(entry));
148
- else
149
- suite._addTest(TestCase._parse(entry));
150
- }
151
- return suite;
152
- }
153
- forEachTest(visitor) {
154
- for (const entry of this._entries) {
155
- if (entry instanceof Suite)
156
- entry.forEachTest(visitor);
157
- else
158
- visitor(entry, this);
159
- }
160
- }
161
- _serialize() {
162
- return {
163
- kind: "suite",
164
- title: this.title,
165
- type: this._type,
166
- location: this.location,
167
- only: this._only,
168
- requireFile: this._requireFile,
169
- timeout: this._timeout,
170
- retries: this._retries,
171
- staticAnnotations: this._staticAnnotations.slice(),
172
- tags: this._tags.slice(),
173
- modifiers: this._modifiers.slice(),
174
- parallelMode: this._parallelMode,
175
- hooks: this._hooks.map((h) => ({ type: h.type, location: h.location, title: h.title })),
176
- fileId: this._fileId
177
- };
178
- }
179
- static _parse(data) {
180
- const suite = new Suite(data.title, data.type);
181
- suite.location = data.location;
182
- suite._only = data.only;
183
- suite._requireFile = data.requireFile;
184
- suite._timeout = data.timeout;
185
- suite._retries = data.retries;
186
- suite._staticAnnotations = data.staticAnnotations;
187
- suite._tags = data.tags;
188
- suite._modifiers = data.modifiers;
189
- suite._parallelMode = data.parallelMode;
190
- suite._hooks = data.hooks.map((h) => ({ type: h.type, location: h.location, title: h.title, fn: () => {
191
- } }));
192
- suite._fileId = data.fileId;
193
- return suite;
194
- }
195
- _clone() {
196
- const data = this._serialize();
197
- const suite = Suite._parse(data);
198
- suite._use = this._use.slice();
199
- suite._hooks = this._hooks.slice();
200
- suite._fullProject = this._fullProject;
201
- return suite;
202
- }
203
- project() {
204
- return this._fullProject?.project || this.parent?.project();
205
- }
206
- }
207
- class TestCase extends Base {
208
- constructor(title, fn, testType, location) {
209
- super(title);
210
- this.results = [];
211
- this.type = "test";
212
- this.expectedStatus = "passed";
213
- this.timeout = 0;
214
- this.annotations = [];
215
- this.retries = 0;
216
- this.repeatEachIndex = 0;
217
- this.id = "";
218
- this._poolDigest = "";
219
- this._workerHash = "";
220
- this._projectId = "";
221
- // Explicitly declared tags that are not a part of the title.
222
- this._tags = [];
223
- this.fn = fn;
224
- this._testType = testType;
225
- this.location = location;
226
- }
227
- titlePath() {
228
- const titlePath = this.parent ? this.parent.titlePath() : [];
229
- titlePath.push(this.title);
230
- return titlePath;
231
- }
232
- outcome() {
233
- return (0, import_teleReceiver.computeTestCaseOutcome)(this);
234
- }
235
- ok() {
236
- const status = this.outcome();
237
- return status === "expected" || status === "flaky" || status === "skipped";
238
- }
239
- get tags() {
240
- const titleTags = this._grepBaseTitlePath().join(" ").match(/@[\S]+/g) || [];
241
- return [
242
- ...titleTags,
243
- ...this._tags
244
- ];
245
- }
246
- _serialize() {
247
- return {
248
- kind: "test",
249
- id: this.id,
250
- title: this.title,
251
- retries: this.retries,
252
- timeout: this.timeout,
253
- expectedStatus: this.expectedStatus,
254
- location: this.location,
255
- only: this._only,
256
- requireFile: this._requireFile,
257
- poolDigest: this._poolDigest,
258
- workerHash: this._workerHash,
259
- annotations: this.annotations.slice(),
260
- tags: this._tags.slice(),
261
- projectId: this._projectId
262
- };
263
- }
264
- static _parse(data) {
265
- const test = new TestCase(data.title, () => {
266
- }, import_testType.rootTestType, data.location);
267
- test.id = data.id;
268
- test.retries = data.retries;
269
- test.timeout = data.timeout;
270
- test.expectedStatus = data.expectedStatus;
271
- test._only = data.only;
272
- test._requireFile = data.requireFile;
273
- test._poolDigest = data.poolDigest;
274
- test._workerHash = data.workerHash;
275
- test.annotations = data.annotations;
276
- test._tags = data.tags;
277
- test._projectId = data.projectId;
278
- return test;
279
- }
280
- _clone() {
281
- const data = this._serialize();
282
- const test = TestCase._parse(data);
283
- test._testType = this._testType;
284
- test.fn = this.fn;
285
- return test;
286
- }
287
- _appendTestResult() {
288
- const result = {
289
- retry: this.results.length,
290
- parallelIndex: -1,
291
- workerIndex: -1,
292
- duration: 0,
293
- startTime: /* @__PURE__ */ new Date(),
294
- stdout: [],
295
- stderr: [],
296
- attachments: [],
297
- status: "skipped",
298
- steps: [],
299
- errors: [],
300
- annotations: []
301
- };
302
- this.results.push(result);
303
- return result;
304
- }
305
- _grepBaseTitlePath() {
306
- const path = [];
307
- this.parent._collectGrepTitlePath(path);
308
- path.push(this.title);
309
- return path;
310
- }
311
- _grepTitleWithTags() {
312
- const path = this._grepBaseTitlePath();
313
- path.push(...this._tags);
314
- return path.join(" ");
315
- }
316
- }
317
- // Annotate the CommonJS export names for ESM import in node:
318
- 0 && (module.exports = {
319
- Suite,
320
- TestCase
321
- });
@@ -1,101 +0,0 @@
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 testLoader_exports = {};
30
- __export(testLoader_exports, {
31
- defaultTimeout: () => defaultTimeout,
32
- loadTestFile: () => loadTestFile
33
- });
34
- module.exports = __toCommonJS(testLoader_exports);
35
- var import_path = __toESM(require("path"));
36
- var import_util = __toESM(require("util"));
37
- var esmLoaderHost = __toESM(require("./esmLoaderHost"));
38
- var import_globals = require("./globals");
39
- var import_test = require("./test");
40
- var import_compilationCache = require("../transform/compilationCache");
41
- var import_transform = require("../transform/transform");
42
- var import_util2 = require("../util");
43
- const defaultTimeout = 3e4;
44
- const cachedFileSuites = /* @__PURE__ */ new Map();
45
- async function loadTestFile(file, config, testErrors) {
46
- if (cachedFileSuites.has(file))
47
- return cachedFileSuites.get(file);
48
- const suite = new import_test.Suite(import_path.default.relative(config.config.rootDir, file) || import_path.default.basename(file), "file");
49
- suite._requireFile = file;
50
- suite.location = { file, line: 0, column: 0 };
51
- suite._tags = [...config.config.tags];
52
- (0, import_globals.setCurrentlyLoadingFileSuite)(suite);
53
- if (!(0, import_globals.isWorkerProcess)()) {
54
- (0, import_compilationCache.startCollectingFileDeps)();
55
- await esmLoaderHost.startCollectingFileDeps();
56
- }
57
- try {
58
- await (0, import_transform.requireOrImport)(file);
59
- cachedFileSuites.set(file, suite);
60
- } catch (e) {
61
- if (!testErrors)
62
- throw e;
63
- testErrors.push(serializeLoadError(file, e));
64
- } finally {
65
- (0, import_globals.setCurrentlyLoadingFileSuite)(void 0);
66
- if (!(0, import_globals.isWorkerProcess)()) {
67
- (0, import_compilationCache.stopCollectingFileDeps)(file);
68
- await esmLoaderHost.stopCollectingFileDeps(file);
69
- }
70
- }
71
- {
72
- const files = /* @__PURE__ */ new Set();
73
- suite.allTests().map((t) => files.add(t.location.file));
74
- if (files.size === 1) {
75
- const mappedFile = files.values().next().value;
76
- if (suite.location.file !== mappedFile) {
77
- if (import_path.default.extname(mappedFile) !== import_path.default.extname(suite.location.file))
78
- suite.location.file = mappedFile;
79
- }
80
- }
81
- }
82
- return suite;
83
- }
84
- function serializeLoadError(file, error) {
85
- if (error instanceof Error) {
86
- const result = (0, import_util2.filterStackTrace)(error);
87
- const loc = error.loc;
88
- result.location = loc ? {
89
- file,
90
- line: loc.line || 0,
91
- column: loc.column || 0
92
- } : void 0;
93
- return result;
94
- }
95
- return { value: import_util.default.inspect(error) };
96
- }
97
- // Annotate the CommonJS export names for ESM import in node:
98
- 0 && (module.exports = {
99
- defaultTimeout,
100
- loadTestFile
101
- });