@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
package/cli.js ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Copyright (c) Microsoft Corporation.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ const { program } = require('./lib/program');
19
+ program.parse(process.argv);
package/index.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export * from 'playwright-core';
package/index.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ module.exports = require('@ohos-ports/playwright-core');
package/index.mjs ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export * from '@ohos-ports/playwright-core';
17
+ import playwright from '@ohos-ports/playwright-core';
18
+ export default playwright;
package/jsx-runtime.js ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ function jsx(type, props, key) {
18
+ return {
19
+ __pw_type: 'jsx',
20
+ type,
21
+ props,
22
+ key,
23
+ };
24
+ }
25
+
26
+ function jsxs(type, props, key) {
27
+ return {
28
+ __pw_type: 'jsx',
29
+ type,
30
+ props,
31
+ key,
32
+ };
33
+ }
34
+
35
+ // this is used in <></> notation
36
+ const Fragment = { __pw_jsx_fragment: true };
37
+
38
+ module.exports = {
39
+ Fragment,
40
+ jsx,
41
+ jsxs,
42
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import jsxRuntime from './jsx-runtime.js';
18
+
19
+ export const jsx = jsxRuntime.jsx;
20
+ export const jsxs = jsxRuntime.jsxs;
21
+ export const Fragment = jsxRuntime.Fragment;
@@ -0,0 +1,272 @@
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 config_exports = {};
30
+ __export(config_exports, {
31
+ FullConfigInternal: () => FullConfigInternal,
32
+ FullProjectInternal: () => FullProjectInternal,
33
+ builtInReporters: () => builtInReporters,
34
+ defaultGrep: () => defaultGrep,
35
+ defaultReporter: () => defaultReporter,
36
+ defaultTimeout: () => defaultTimeout,
37
+ getProjectId: () => getProjectId,
38
+ takeFirst: () => takeFirst,
39
+ toReporters: () => toReporters
40
+ });
41
+ module.exports = __toCommonJS(config_exports);
42
+ var import_fs = __toESM(require("fs"));
43
+ var import_os = __toESM(require("os"));
44
+ var import_path = __toESM(require("path"));
45
+ var import_util = require("../util");
46
+ const defaultTimeout = 3e4;
47
+ class FullConfigInternal {
48
+ constructor(location, userConfig, configCLIOverrides, metadata) {
49
+ this.projects = [];
50
+ this.cliArgs = [];
51
+ this.cliListOnly = false;
52
+ this.defineConfigWasUsed = false;
53
+ this.globalSetups = [];
54
+ this.globalTeardowns = [];
55
+ if (configCLIOverrides.projects && userConfig.projects)
56
+ throw new Error(`Cannot use --browser option when configuration file defines projects. Specify browserName in the projects instead.`);
57
+ const { resolvedConfigFile, configDir } = location;
58
+ const packageJsonPath = (0, import_util.getPackageJsonPath)(configDir);
59
+ const packageJsonDir = packageJsonPath ? import_path.default.dirname(packageJsonPath) : process.cwd();
60
+ this.configDir = configDir;
61
+ this.configCLIOverrides = configCLIOverrides;
62
+ const privateConfiguration = userConfig["@playwright/test"];
63
+ this.plugins = (privateConfiguration?.plugins || []).map((p) => ({ factory: p }));
64
+ this.singleTSConfigPath = pathResolve(configDir, userConfig.tsconfig);
65
+ this.captureGitInfo = userConfig.captureGitInfo;
66
+ this.failOnFlakyTests = takeFirst(configCLIOverrides.failOnFlakyTests, userConfig.failOnFlakyTests, false);
67
+ this.globalSetups = (Array.isArray(userConfig.globalSetup) ? userConfig.globalSetup : [userConfig.globalSetup]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
68
+ this.globalTeardowns = (Array.isArray(userConfig.globalTeardown) ? userConfig.globalTeardown : [userConfig.globalTeardown]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
69
+ userConfig.metadata = userConfig.metadata || {};
70
+ this.config = {
71
+ configFile: resolvedConfigFile,
72
+ rootDir: pathResolve(configDir, userConfig.testDir) || configDir,
73
+ forbidOnly: takeFirst(configCLIOverrides.forbidOnly, userConfig.forbidOnly, false),
74
+ fullyParallel: takeFirst(configCLIOverrides.fullyParallel, userConfig.fullyParallel, false),
75
+ globalSetup: this.globalSetups[0] ?? null,
76
+ globalTeardown: this.globalTeardowns[0] ?? null,
77
+ globalTimeout: takeFirst(configCLIOverrides.debug ? 0 : void 0, configCLIOverrides.globalTimeout, userConfig.globalTimeout, 0),
78
+ grep: takeFirst(userConfig.grep, defaultGrep),
79
+ grepInvert: takeFirst(userConfig.grepInvert, null),
80
+ maxFailures: takeFirst(configCLIOverrides.debug ? 1 : void 0, configCLIOverrides.maxFailures, userConfig.maxFailures, 0),
81
+ metadata: metadata ?? userConfig.metadata,
82
+ preserveOutput: takeFirst(userConfig.preserveOutput, "always"),
83
+ reporter: takeFirst(configCLIOverrides.reporter, resolveReporters(userConfig.reporter, configDir), [[defaultReporter]]),
84
+ reportSlowTests: takeFirst(userConfig.reportSlowTests, {
85
+ max: 5,
86
+ threshold: 3e5
87
+ /* 5 minutes */
88
+ }),
89
+ quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false),
90
+ projects: [],
91
+ shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null),
92
+ updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, "missing"),
93
+ updateSourceMethod: takeFirst(configCLIOverrides.updateSourceMethod, userConfig.updateSourceMethod, "patch"),
94
+ version: require("../../package.json").version,
95
+ workers: resolveWorkers(takeFirst(configCLIOverrides.debug ? 1 : void 0, configCLIOverrides.workers, userConfig.workers, "50%")),
96
+ webServer: null
97
+ };
98
+ for (const key in userConfig) {
99
+ if (key.startsWith("@"))
100
+ this.config[key] = userConfig[key];
101
+ }
102
+ this.config[configInternalSymbol] = this;
103
+ const webServers = takeFirst(userConfig.webServer, null);
104
+ if (Array.isArray(webServers)) {
105
+ this.config.webServer = null;
106
+ this.webServers = webServers;
107
+ } else if (webServers) {
108
+ this.config.webServer = webServers;
109
+ this.webServers = [webServers];
110
+ } else {
111
+ this.webServers = [];
112
+ }
113
+ const projectConfigs = configCLIOverrides.projects || userConfig.projects || [userConfig];
114
+ this.projects = projectConfigs.map((p) => new FullProjectInternal(configDir, userConfig, this, p, this.configCLIOverrides, packageJsonDir));
115
+ resolveProjectDependencies(this.projects);
116
+ this._assignUniqueProjectIds(this.projects);
117
+ this.config.projects = this.projects.map((p) => p.project);
118
+ }
119
+ _assignUniqueProjectIds(projects) {
120
+ const usedNames = /* @__PURE__ */ new Set();
121
+ for (const p of projects) {
122
+ const name = p.project.name || "";
123
+ for (let i = 0; i < projects.length; ++i) {
124
+ const candidate = name + (i ? i : "");
125
+ if (usedNames.has(candidate))
126
+ continue;
127
+ p.id = candidate;
128
+ p.project.__projectId = p.id;
129
+ usedNames.add(candidate);
130
+ break;
131
+ }
132
+ }
133
+ }
134
+ }
135
+ class FullProjectInternal {
136
+ constructor(configDir, config, fullConfig, projectConfig, configCLIOverrides, packageJsonDir) {
137
+ this.id = "";
138
+ this.deps = [];
139
+ this.fullConfig = fullConfig;
140
+ const testDir = takeFirst(pathResolve(configDir, projectConfig.testDir), pathResolve(configDir, config.testDir), fullConfig.configDir);
141
+ this.snapshotPathTemplate = takeFirst(projectConfig.snapshotPathTemplate, config.snapshotPathTemplate);
142
+ this.project = {
143
+ grep: takeFirst(projectConfig.grep, config.grep, defaultGrep),
144
+ grepInvert: takeFirst(projectConfig.grepInvert, config.grepInvert, null),
145
+ outputDir: takeFirst(configCLIOverrides.outputDir, pathResolve(configDir, projectConfig.outputDir), pathResolve(configDir, config.outputDir), import_path.default.join(packageJsonDir, "test-results")),
146
+ // Note: we either apply the cli override for repeatEach or not, depending on whether the
147
+ // project is top-level vs dependency. See collectProjectsAndTestFiles in loadUtils.
148
+ repeatEach: takeFirst(projectConfig.repeatEach, config.repeatEach, 1),
149
+ retries: takeFirst(configCLIOverrides.retries, projectConfig.retries, config.retries, 0),
150
+ metadata: takeFirst(projectConfig.metadata, config.metadata, {}),
151
+ name: takeFirst(projectConfig.name, config.name, ""),
152
+ testDir,
153
+ snapshotDir: takeFirst(pathResolve(configDir, projectConfig.snapshotDir), pathResolve(configDir, config.snapshotDir), testDir),
154
+ testIgnore: takeFirst(projectConfig.testIgnore, config.testIgnore, []),
155
+ testMatch: takeFirst(projectConfig.testMatch, config.testMatch, "**/*.@(spec|test).?(c|m)[jt]s?(x)"),
156
+ timeout: takeFirst(configCLIOverrides.debug ? 0 : void 0, configCLIOverrides.timeout, projectConfig.timeout, config.timeout, defaultTimeout),
157
+ use: (0, import_util.mergeObjects)(config.use, projectConfig.use, configCLIOverrides.use),
158
+ dependencies: projectConfig.dependencies || [],
159
+ teardown: projectConfig.teardown
160
+ };
161
+ this.fullyParallel = takeFirst(configCLIOverrides.fullyParallel, projectConfig.fullyParallel, config.fullyParallel, void 0);
162
+ this.expect = takeFirst(projectConfig.expect, config.expect, {});
163
+ if (this.expect.toHaveScreenshot?.stylePath) {
164
+ const stylePaths = Array.isArray(this.expect.toHaveScreenshot.stylePath) ? this.expect.toHaveScreenshot.stylePath : [this.expect.toHaveScreenshot.stylePath];
165
+ this.expect.toHaveScreenshot.stylePath = stylePaths.map((stylePath) => import_path.default.resolve(configDir, stylePath));
166
+ }
167
+ this.respectGitIgnore = takeFirst(projectConfig.respectGitIgnore, config.respectGitIgnore, !projectConfig.testDir && !config.testDir);
168
+ this.ignoreSnapshots = takeFirst(configCLIOverrides.ignoreSnapshots, projectConfig.ignoreSnapshots, config.ignoreSnapshots, false);
169
+ this.workers = projectConfig.workers ? resolveWorkers(projectConfig.workers) : void 0;
170
+ if (configCLIOverrides.debug && this.workers)
171
+ this.workers = 1;
172
+ }
173
+ }
174
+ function takeFirst(...args) {
175
+ for (const arg of args) {
176
+ if (arg !== void 0)
177
+ return arg;
178
+ }
179
+ return void 0;
180
+ }
181
+ function pathResolve(baseDir, relative) {
182
+ if (!relative)
183
+ return void 0;
184
+ return import_path.default.resolve(baseDir, relative);
185
+ }
186
+ function resolveReporters(reporters, rootDir) {
187
+ return toReporters(reporters)?.map(([id, arg]) => {
188
+ if (builtInReporters.includes(id))
189
+ return [id, arg];
190
+ return [require.resolve(id, { paths: [rootDir] }), arg];
191
+ });
192
+ }
193
+ function resolveWorkers(workers) {
194
+ if (typeof workers === "string") {
195
+ if (workers.endsWith("%")) {
196
+ const cpus = import_os.default.cpus().length;
197
+ return Math.max(1, Math.floor(cpus * (parseInt(workers, 10) / 100)));
198
+ }
199
+ const parsedWorkers = parseInt(workers, 10);
200
+ if (isNaN(parsedWorkers))
201
+ throw new Error(`Workers ${workers} must be a number or percentage.`);
202
+ return parsedWorkers;
203
+ }
204
+ return workers;
205
+ }
206
+ function resolveProjectDependencies(projects) {
207
+ const teardownSet = /* @__PURE__ */ new Set();
208
+ for (const project of projects) {
209
+ for (const dependencyName of project.project.dependencies) {
210
+ const dependencies = projects.filter((p) => p.project.name === dependencyName);
211
+ if (!dependencies.length)
212
+ throw new Error(`Project '${project.project.name}' depends on unknown project '${dependencyName}'`);
213
+ if (dependencies.length > 1)
214
+ throw new Error(`Project dependencies should have unique names, reading ${dependencyName}`);
215
+ project.deps.push(...dependencies);
216
+ }
217
+ if (project.project.teardown) {
218
+ const teardowns = projects.filter((p) => p.project.name === project.project.teardown);
219
+ if (!teardowns.length)
220
+ throw new Error(`Project '${project.project.name}' has unknown teardown project '${project.project.teardown}'`);
221
+ if (teardowns.length > 1)
222
+ throw new Error(`Project teardowns should have unique names, reading ${project.project.teardown}`);
223
+ const teardown = teardowns[0];
224
+ project.teardown = teardown;
225
+ teardownSet.add(teardown);
226
+ }
227
+ }
228
+ for (const teardown of teardownSet) {
229
+ if (teardown.deps.length)
230
+ throw new Error(`Teardown project ${teardown.project.name} must not have dependencies`);
231
+ }
232
+ for (const project of projects) {
233
+ for (const dep of project.deps) {
234
+ if (teardownSet.has(dep))
235
+ throw new Error(`Project ${project.project.name} must not depend on a teardown project ${dep.project.name}`);
236
+ }
237
+ }
238
+ }
239
+ function toReporters(reporters) {
240
+ if (!reporters)
241
+ return;
242
+ if (typeof reporters === "string")
243
+ return [[reporters]];
244
+ return reporters;
245
+ }
246
+ const builtInReporters = ["list", "line", "dot", "json", "junit", "null", "github", "html", "blob"];
247
+ function resolveScript(id, rootDir) {
248
+ if (!id)
249
+ return void 0;
250
+ const localPath = import_path.default.resolve(rootDir, id);
251
+ if (import_fs.default.existsSync(localPath))
252
+ return localPath;
253
+ return require.resolve(id, { paths: [rootDir] });
254
+ }
255
+ const defaultGrep = /.*/;
256
+ const defaultReporter = process.env.CI ? "dot" : "list";
257
+ const configInternalSymbol = Symbol("configInternalSymbol");
258
+ function getProjectId(project) {
259
+ return project.__projectId;
260
+ }
261
+ // Annotate the CommonJS export names for ESM import in node:
262
+ 0 && (module.exports = {
263
+ FullConfigInternal,
264
+ FullProjectInternal,
265
+ builtInReporters,
266
+ defaultGrep,
267
+ defaultReporter,
268
+ defaultTimeout,
269
+ getProjectId,
270
+ takeFirst,
271
+ toReporters
272
+ });