@smoothdeploy/playwright 1.60.1 → 1.61.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.
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  var generateAgents_exports = {};
30
30
  __export(generateAgents_exports, {
31
31
  ClaudeGenerator: () => ClaudeGenerator,
32
+ CodexGenerator: () => CodexGenerator,
32
33
  CopilotGenerator: () => CopilotGenerator,
33
34
  OpencodeGenerator: () => OpencodeGenerator,
34
35
  VSCodeGenerator: () => VSCodeGenerator
@@ -40,6 +41,7 @@ var import_seed = require("../mcp/test/seed");
40
41
  var import_agentParser = require("./agentParser");
41
42
  const colors = require("playwright-core/lib/utilsBundle").colors;
42
43
  const yaml = require("playwright-core/lib/utilsBundle").yaml;
44
+ const { tomlArray, tomlBasicString, tomlMultilineBasicString } = require("playwright-core/lib/coreBundle").iso;
43
45
  const { mkdirIfNeeded } = require("playwright-core/lib/coreBundle").utils;
44
46
  async function loadAgentSpecs() {
45
47
  const files = await import_fs.default.promises.readdir(__dirname);
@@ -89,6 +91,51 @@ class ClaudeGenerator {
89
91
  return lines.join("\n");
90
92
  }
91
93
  }
94
+ class CodexGenerator {
95
+ static async init(fullConfig, projectName, prompts) {
96
+ await initRepo(fullConfig, projectName, {
97
+ promptsFolder: prompts ? ".codex/prompts" : void 0
98
+ });
99
+ const agents = await loadAgentSpecs();
100
+ await import_fs.default.promises.mkdir(".codex/agents", { recursive: true });
101
+ for (const agent of agents)
102
+ await writeFile(`.codex/agents/${CodexGenerator.codexName(agent)}.toml`, CodexGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
103
+ initRepoDone();
104
+ }
105
+ // Codex's subagent registry rejects hyphenated identifiers at spawn time with
106
+ // `error=unknown agent_type '<name>'`. Codex's own documentation only shows
107
+ // snake_case names (`pr_explorer`, `reviewer`, `docs_researcher`, ...), see
108
+ // https://developers.openai.com/codex/subagents. Translate the shared agent
109
+ // name into snake_case so the filename and the `name` field stay in sync.
110
+ static codexName(agent) {
111
+ return agent.name.replace(/-/g, "_");
112
+ }
113
+ static agentSpec(agent) {
114
+ const mcpName = "playwright-test";
115
+ const enabledTools = [];
116
+ for (const tool of agent.tools) {
117
+ const [first, second] = tool.split("/");
118
+ if (second && first === mcpName)
119
+ enabledTools.push(second);
120
+ }
121
+ const sandboxMode = agent.tools.includes("edit") ? "workspace-write" : "read-only";
122
+ const mcpServer = process.platform === "win32" ? { command: "cmd", args: ["/c", "npx", "playwright", "run-test-mcp-server"] } : { command: "npx", args: ["playwright", "run-test-mcp-server"] };
123
+ const examples = agent.examples.length ? ` Examples: ${agent.examples.map((example) => `<example>${example}</example>`).join("")}` : "";
124
+ const lines = [];
125
+ lines.push(`name = ${tomlBasicString(CodexGenerator.codexName(agent))}`);
126
+ lines.push(`description = ${tomlBasicString(agent.description + examples)}`);
127
+ lines.push(`sandbox_mode = ${tomlBasicString(sandboxMode)}`);
128
+ lines.push(`developer_instructions = ${tomlMultilineBasicString(agent.instructions)}`);
129
+ lines.push("");
130
+ lines.push(`[mcp_servers.${mcpName}]`);
131
+ lines.push(`command = ${tomlBasicString(mcpServer.command)}`);
132
+ lines.push(`args = ${tomlArray(mcpServer.args)}`);
133
+ if (enabledTools.length)
134
+ lines.push(`enabled_tools = ${tomlArray(enabledTools)}`);
135
+ lines.push("");
136
+ return lines.join("\n");
137
+ }
138
+ }
92
139
  class OpencodeGenerator {
93
140
  static async init(fullConfig, projectName, prompts) {
94
141
  await initRepo(fullConfig, projectName, {
@@ -341,6 +388,7 @@ async function loadPrompt(file, params) {
341
388
  // Annotate the CommonJS export names for ESM import in node:
342
389
  0 && (module.exports = {
343
390
  ClaudeGenerator,
391
+ CodexGenerator,
344
392
  CopilotGenerator,
345
393
  OpencodeGenerator,
346
394
  VSCodeGenerator
@@ -42,6 +42,7 @@ const { startProfiling, stopProfiling } = require("playwright-core/lib/coreBundl
42
42
  async function runTests(args, opts) {
43
43
  await startProfiling();
44
44
  const cliOverrides = overridesFromOptions(opts);
45
+ cliOverrides.argv = process.argv;
45
46
  const config = await import_common.configLoader.loadConfigFromFile(opts.config, cliOverrides, opts.deps === false);
46
47
  const options = {
47
48
  locations: args.length ? args : void 0,
@@ -52,6 +53,7 @@ async function runTests(args, opts) {
52
53
  projectFilter: opts.project || void 0,
53
54
  passWithNoTests: !!opts.passWithNoTests,
54
55
  lastFailed: !!opts.lastFailed,
56
+ lastFailedFile: opts.lastFailedFile,
55
57
  testList: opts.testList ? import_path.default.resolve(process.cwd(), opts.testList) : void 0,
56
58
  testListInvert: opts.testListInvert ? import_path.default.resolve(process.cwd(), opts.testListInvert) : void 0,
57
59
  shardWeights: resolveShardWeightsOption()
@@ -37,7 +37,6 @@ __export(index_exports, {
37
37
  config: () => config_exports,
38
38
  configLoader: () => configLoader_exports,
39
39
  defineConfig: () => defineConfig,
40
- esm: () => esmLoaderHost_exports,
41
40
  fixtures: () => fixtures_exports,
42
41
  ipc: () => ipc_exports,
43
42
  mergeTests: () => mergeTests,
@@ -311,7 +310,6 @@ var import_package2 = require("../package");
311
310
  // packages/playwright/src/util.ts
312
311
  var import_fs2 = __toESM(require("fs"));
313
312
  var import_path2 = __toESM(require("path"));
314
- var import_url = __toESM(require("url"));
315
313
  var import_util = __toESM(require("util"));
316
314
  var debug = require("playwright-core/lib/utilsBundle").debug;
317
315
  var mime = require("playwright-core/lib/utilsBundle").mime;
@@ -391,10 +389,10 @@ function createFileMatcher(patterns) {
391
389
  return true;
392
390
  }
393
391
  if (import_path2.default.sep === "\\") {
394
- const fileURL = import_url.default.pathToFileURL(filePath).href;
392
+ const unixPath = filePath.split(import_path2.default.sep).join("/");
395
393
  for (const re of reList) {
396
394
  re.lastIndex = 0;
397
- if (re.test(fileURL))
395
+ if (re.test(unixPath))
398
396
  return true;
399
397
  }
400
398
  }
@@ -460,11 +458,20 @@ function fileIsModule(file2) {
460
458
  const folder = import_path2.default.dirname(file2);
461
459
  return folderIsModule(folder);
462
460
  }
461
+ var packageJsonIsModuleCache = /* @__PURE__ */ new Map();
463
462
  function folderIsModule(folder) {
464
463
  const packageJsonPath = getPackageJsonPath(folder);
465
464
  if (!packageJsonPath)
466
465
  return false;
467
- return require(packageJsonPath).type === "module";
466
+ if (!packageJsonIsModuleCache.has(packageJsonPath)) {
467
+ let isModule2 = false;
468
+ try {
469
+ isModule2 = JSON.parse(import_fs2.default.readFileSync(packageJsonPath, "utf8")).type === "module";
470
+ } catch {
471
+ }
472
+ packageJsonIsModuleCache.set(packageJsonPath, isModule2);
473
+ }
474
+ return packageJsonIsModuleCache.get(packageJsonPath);
468
475
  }
469
476
  var packageJsonMainFieldCache = /* @__PURE__ */ new Map();
470
477
  function getMainFieldFromPackageJson(packageJsonPath) {
@@ -549,7 +556,6 @@ var FullConfigInternal = class {
549
556
  this.plugins = (privateConfiguration?.plugins || []).map((p) => ({ factory: p }));
550
557
  this.singleTSConfigPath = pathResolve(configDir, userConfig.tsconfig);
551
558
  this.captureGitInfo = userConfig.captureGitInfo;
552
- this.failOnFlakyTests = takeFirst(configCLIOverrides.failOnFlakyTests, userConfig.failOnFlakyTests, false);
553
559
  this.globalSetups = (Array.isArray(userConfig.globalSetup) ? userConfig.globalSetup : [userConfig.globalSetup]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
554
560
  this.globalTeardowns = (Array.isArray(userConfig.globalTeardown) ? userConfig.globalTeardown : [userConfig.globalTeardown]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
555
561
  userConfig.metadata = userConfig.metadata || {};
@@ -559,8 +565,10 @@ var FullConfigInternal = class {
559
565
  throw new Error(`Tag must start with "@" symbol, got "${tag}" instead.`);
560
566
  }
561
567
  this.config = {
568
+ argv: configCLIOverrides.argv ?? [],
562
569
  configFile: resolvedConfigFile,
563
570
  rootDir: pathResolve(configDir, userConfig.testDir) || configDir,
571
+ failOnFlakyTests: takeFirst(configCLIOverrides.failOnFlakyTests, userConfig.failOnFlakyTests, false),
564
572
  forbidOnly: takeFirst(configCLIOverrides.forbidOnly, userConfig.forbidOnly, false),
565
573
  fullyParallel: takeFirst(configCLIOverrides.fullyParallel, userConfig.fullyParallel, false),
566
574
  globalSetup: this.globalSetups[0] ?? null,
@@ -758,24 +766,25 @@ __export(configLoader_exports, {
758
766
  loadEmptyConfigForMergeReports: () => loadEmptyConfigForMergeReports,
759
767
  resolveConfigLocation: () => resolveConfigLocation
760
768
  });
761
- var import_fs6 = __toESM(require("fs"));
769
+ var import_fs7 = __toESM(require("fs"));
762
770
  var import_path7 = __toESM(require("path"));
763
771
 
764
772
  // packages/playwright/src/transform/transform.ts
765
773
  var transform_exports = {};
766
774
  __export(transform_exports, {
775
+ incorporateCompilationCache: () => incorporateCompilationCache,
767
776
  requireOrImport: () => requireOrImport,
768
777
  resolveHook: () => resolveHook,
769
778
  setSingleTSConfig: () => setSingleTSConfig,
770
779
  setTransformConfig: () => setTransformConfig,
771
780
  setTransformData: () => setTransformData,
772
781
  shouldTransform: () => shouldTransform,
773
- singleTSConfig: () => singleTSConfig,
774
- transformConfig: () => transformConfig,
782
+ startCollectingFileDeps: () => startCollectingFileDeps2,
783
+ stopCollectingFileDeps: () => stopCollectingFileDeps2,
775
784
  transformHook: () => transformHook,
776
785
  wrapFunctionWithLocation: () => wrapFunctionWithLocation
777
786
  });
778
- var import_fs5 = __toESM(require("fs"));
787
+ var import_fs6 = __toESM(require("fs"));
779
788
  var import_module2 = __toESM(require("module"));
780
789
  var import_path6 = __toESM(require("path"));
781
790
  var import_url2 = __toESM(require("url"));
@@ -852,6 +861,49 @@ function StripBom(string) {
852
861
  // packages/playwright/src/transform/transform.ts
853
862
  var import_package3 = require("../package");
854
863
 
864
+ // packages/playwright/src/transform/esmLoaderSync.ts
865
+ var import_fs5 = __toESM(require("fs"));
866
+ var import_url = __toESM(require("url"));
867
+ function resolve(specifier, context, nextResolve) {
868
+ if (context.parentURL && context.parentURL.startsWith("file://")) {
869
+ const filename = import_url.default.fileURLToPath(context.parentURL);
870
+ const resolved = resolveHook(filename, specifier);
871
+ if (resolved !== void 0) {
872
+ specifier = context.conditions?.includes("import") ? import_url.default.pathToFileURL(resolved).toString() : resolved;
873
+ }
874
+ }
875
+ const result2 = nextResolve(specifier, context);
876
+ if (result2?.url && result2.url.startsWith("file://"))
877
+ currentFileDepsCollector()?.add(import_url.default.fileURLToPath(result2.url));
878
+ return result2;
879
+ }
880
+ var kSupportedFormats = /* @__PURE__ */ new Map([
881
+ ["commonjs", "commonjs"],
882
+ ["module", "module"],
883
+ ["commonjs-typescript", "commonjs"],
884
+ ["module-typescript", "module"],
885
+ ["typescript", null],
886
+ [null, null],
887
+ [void 0, void 0]
888
+ ]);
889
+ function load(moduleUrl, context, nextLoad) {
890
+ if (!kSupportedFormats.has(context.format))
891
+ return nextLoad(moduleUrl, context);
892
+ if (!moduleUrl.startsWith("file://"))
893
+ return nextLoad(moduleUrl, context);
894
+ const filename = import_url.default.fileURLToPath(moduleUrl);
895
+ if (!shouldTransform(filename))
896
+ return nextLoad(moduleUrl, context);
897
+ const format = kSupportedFormats.get(context.format) || (fileIsModule(filename) ? "module" : "commonjs");
898
+ const code = import_fs5.default.readFileSync(filename, "utf-8");
899
+ const transformed = transformHook(code, filename, format === "module" ? moduleUrl : void 0);
900
+ return {
901
+ format,
902
+ source: transformed.code,
903
+ shortCircuit: true
904
+ };
905
+ }
906
+
855
907
  // packages/playwright/src/transform/pirates.ts
856
908
  var import_module = __toESM(require("module"));
857
909
  var import_path5 = __toESM(require("path"));
@@ -879,6 +931,48 @@ function addHook(transformHook2, shouldTransform2, extensions) {
879
931
  }
880
932
  }
881
933
 
934
+ // packages/playwright/src/transform/portTransport.ts
935
+ var PortTransport = class {
936
+ constructor(port, handler) {
937
+ this._lastId = 0;
938
+ this._callbacks = /* @__PURE__ */ new Map();
939
+ this._port = port;
940
+ port.addEventListener("message", async (event) => {
941
+ const message = event.data;
942
+ const { id, ackId, method, params, result: result2 } = message;
943
+ if (ackId) {
944
+ const callback = this._callbacks.get(ackId);
945
+ this._callbacks.delete(ackId);
946
+ this._resetRef();
947
+ callback?.(result2);
948
+ return;
949
+ }
950
+ const handlerResult = await handler(method, params);
951
+ if (id)
952
+ this._port.postMessage({ ackId: id, result: handlerResult });
953
+ });
954
+ this._resetRef();
955
+ }
956
+ post(method, params) {
957
+ this._port.postMessage({ method, params });
958
+ }
959
+ async send(method, params) {
960
+ return await new Promise((f) => {
961
+ const id = ++this._lastId;
962
+ this._callbacks.set(id, f);
963
+ this._resetRef();
964
+ this._port.postMessage({ id, method, params });
965
+ });
966
+ }
967
+ _resetRef() {
968
+ if (this._callbacks.size) {
969
+ this._port.ref();
970
+ } else {
971
+ this._port.unref();
972
+ }
973
+ }
974
+ };
975
+
882
976
  // packages/playwright/src/transform/transform.ts
883
977
  var sourceMapSupport2 = require("playwright-core/lib/utilsBundle").sourceMapSupport;
884
978
  var version = import_package3.packageJSON.version;
@@ -888,20 +982,18 @@ var _transformConfig = {
888
982
  external: []
889
983
  };
890
984
  var _externalMatcher = () => false;
891
- function setTransformConfig(config) {
985
+ async function setTransformConfig(config) {
892
986
  _transformConfig = config;
893
987
  _externalMatcher = createFileMatcher(_transformConfig.external);
894
- }
895
- function transformConfig() {
896
- return _transformConfig;
988
+ if (loaderChannel)
989
+ await loaderChannel.send("setTransformConfig", { config });
897
990
  }
898
991
  var _singleTSConfigPath;
899
992
  var _singleTSConfig;
900
- function setSingleTSConfig(value) {
993
+ async function setSingleTSConfig(value) {
901
994
  _singleTSConfigPath = value;
902
- }
903
- function singleTSConfig() {
904
- return _singleTSConfigPath;
995
+ if (loaderChannel)
996
+ await loaderChannel.send("setSingleTSConfig", { tsconfig: value });
905
997
  }
906
998
  function validateTsConfig(tsconfig) {
907
999
  const pathsBase = tsconfig.absoluteBaseUrl ?? tsconfig.paths?.pathsBasePath;
@@ -932,7 +1024,7 @@ function loadAndValidateTsconfigsForFolder(folder) {
932
1024
  foldersWithConfig.push(currentFolder);
933
1025
  for (const name of ["tsconfig.json", "jsconfig.json"]) {
934
1026
  const configPath = import_path6.default.join(currentFolder, name);
935
- if (import_fs5.default.existsSync(configPath)) {
1027
+ if (import_fs6.default.existsSync(configPath)) {
936
1028
  const loaded = loadTsConfig(configPath);
937
1029
  result2 = loaded.map(validateTsConfig);
938
1030
  break;
@@ -1048,15 +1140,21 @@ async function requireOrImport(file) {
1048
1140
  if (isModule) {
1049
1141
  const fileName = import_url2.default.pathToFileURL(file);
1050
1142
  const esmImport = () => eval(`import(${JSON.stringify(fileName)})`);
1051
- await eval(`import(${JSON.stringify(fileName + ".esm.preflight")})`).catch((error) => debugTest("Failed to load preflight for " + file + ", source maps may be missing for errors thrown during loading.", error)).finally(nextTask);
1143
+ if (loaderChannel) {
1144
+ await eval(`import(${JSON.stringify(fileName + ".esm.preflight")})`).catch((error) => debugTest("Failed to load preflight for " + file + ", source maps may be missing for errors thrown during loading.", error)).finally(nextTask);
1145
+ }
1052
1146
  return await esmImport().finally(nextTask);
1053
1147
  }
1054
1148
  const result = require(file);
1055
1149
  const depsCollector = currentFileDepsCollector();
1056
1150
  if (depsCollector) {
1057
1151
  const module2 = require.cache[file];
1058
- if (module2)
1059
- collectCJSDependencies(module2, depsCollector);
1152
+ if (module2) {
1153
+ const cjsDeps = /* @__PURE__ */ new Set();
1154
+ collectCJSDependencies(module2, cjsDeps);
1155
+ for (const dep of cjsDeps)
1156
+ depsCollector.add(dep);
1157
+ }
1060
1158
  }
1061
1159
  return result;
1062
1160
  }
@@ -1065,7 +1163,17 @@ function installTransformIfNeeded() {
1065
1163
  if (transformInstalled)
1066
1164
  return;
1067
1165
  transformInstalled = true;
1166
+ registerESMLoader();
1068
1167
  installSourceMapSupport();
1168
+ if (loaderChannel) {
1169
+ installCJSHooks();
1170
+ return;
1171
+ }
1172
+ const extensions = import_module2.default._extensions;
1173
+ for (const ext of [".ts", ".cts", ".tsx", ".jsx"])
1174
+ extensions[ext] = extensions[".js"];
1175
+ }
1176
+ function installCJSHooks() {
1069
1177
  const originalResolveFilename = import_module2.default._resolveFilename;
1070
1178
  function resolveFilename(specifier, parent, ...rest) {
1071
1179
  if (parent) {
@@ -1115,98 +1223,43 @@ function isRelativeSpecifier(specifier) {
1115
1223
  return specifier === "." || specifier === ".." || specifier.startsWith("./") || specifier.startsWith("../");
1116
1224
  }
1117
1225
  async function nextTask() {
1118
- return new Promise((resolve) => setTimeout(resolve, 0));
1226
+ return new Promise((resolve2) => setTimeout(resolve2, 0));
1119
1227
  }
1120
-
1121
- // packages/playwright/src/common/esmLoaderHost.ts
1122
- var esmLoaderHost_exports = {};
1123
- __export(esmLoaderHost_exports, {
1124
- configureESMLoader: () => configureESMLoader,
1125
- configureESMLoaderTransformConfig: () => configureESMLoaderTransformConfig,
1126
- incorporateCompilationCache: () => incorporateCompilationCache,
1127
- registerESMLoader: () => registerESMLoader,
1128
- startCollectingFileDeps: () => startCollectingFileDeps2,
1129
- stopCollectingFileDeps: () => stopCollectingFileDeps2
1130
- });
1131
- var import_url3 = __toESM(require("url"));
1132
-
1133
- // packages/playwright/src/transform/portTransport.ts
1134
- var PortTransport = class {
1135
- constructor(port, handler) {
1136
- this._lastId = 0;
1137
- this._callbacks = /* @__PURE__ */ new Map();
1138
- this._port = port;
1139
- port.addEventListener("message", async (event) => {
1140
- const message = event.data;
1141
- const { id, ackId, method, params, result: result2 } = message;
1142
- if (ackId) {
1143
- const callback = this._callbacks.get(ackId);
1144
- this._callbacks.delete(ackId);
1145
- this._resetRef();
1146
- callback?.(result2);
1147
- return;
1148
- }
1149
- const handlerResult = await handler(method, params);
1150
- if (id)
1151
- this._port.postMessage({ ackId: id, result: handlerResult });
1152
- });
1153
- this._resetRef();
1154
- }
1155
- post(method, params) {
1156
- this._port.postMessage({ method, params });
1157
- }
1158
- async send(method, params) {
1159
- return await new Promise((f) => {
1160
- const id = ++this._lastId;
1161
- this._callbacks.set(id, f);
1162
- this._resetRef();
1163
- this._port.postMessage({ id, method, params });
1164
- });
1165
- }
1166
- _resetRef() {
1167
- if (this._callbacks.size) {
1168
- this._port.ref();
1169
- } else {
1170
- this._port.unref();
1171
- }
1172
- }
1173
- };
1174
-
1175
- // packages/playwright/src/common/esmLoaderHost.ts
1176
1228
  var loaderChannel;
1177
1229
  function registerESMLoader() {
1178
1230
  if (process.env.PW_DISABLE_TS_ESM)
1179
- return true;
1231
+ return;
1180
1232
  if ("Bun" in globalThis)
1181
- return true;
1182
- if (loaderChannel)
1183
- return true;
1184
- const register = require("node:module").register;
1185
- if (!register)
1186
- return false;
1233
+ return;
1234
+ const nodeModule = require("node:module");
1235
+ if (nodeModule.registerHooks && !process.env.PLAYWRIGHT_FORCE_ASYNC_LOADER) {
1236
+ nodeModule.registerHooks({ resolve, load });
1237
+ return;
1238
+ }
1239
+ if (!nodeModule.register)
1240
+ return;
1187
1241
  const { port1, port2 } = new MessageChannel();
1188
- register(import_url3.default.pathToFileURL(require.resolve("../transform/esmLoader.js")), {
1242
+ nodeModule.register(import_url2.default.pathToFileURL(require.resolve("../transform/esmLoader.js")), {
1189
1243
  data: { port: port2 },
1190
1244
  transferList: [port2]
1191
1245
  });
1192
- loaderChannel = createPortTransport(port1);
1193
- return true;
1194
- }
1195
- function createPortTransport(port) {
1196
- return new PortTransport(port, async (method, params) => {
1246
+ loaderChannel = new PortTransport(port1, async (method, params) => {
1197
1247
  if (method === "pushToCompilationCache")
1198
1248
  addToCompilationCache(params.cache);
1199
1249
  });
1250
+ void loaderChannel.send("setSingleTSConfig", { tsconfig: _singleTSConfigPath });
1251
+ void loaderChannel.send("setTransformConfig", { config: _transformConfig });
1252
+ void loaderChannel.send("addToCompilationCache", { cache: serializeCompilationCache() });
1200
1253
  }
1201
1254
  async function startCollectingFileDeps2() {
1202
- if (!loaderChannel)
1203
- return;
1204
- await loaderChannel.send("startCollectingFileDeps", {});
1255
+ startCollectingFileDeps();
1256
+ if (loaderChannel)
1257
+ await loaderChannel.send("startCollectingFileDeps", {});
1205
1258
  }
1206
1259
  async function stopCollectingFileDeps2(file2) {
1207
- if (!loaderChannel)
1208
- return;
1209
- await loaderChannel.send("stopCollectingFileDeps", { file: file2 });
1260
+ stopCollectingFileDeps(file2);
1261
+ if (loaderChannel)
1262
+ await loaderChannel.send("stopCollectingFileDeps", { file: file2 });
1210
1263
  }
1211
1264
  async function incorporateCompilationCache() {
1212
1265
  if (!loaderChannel)
@@ -1214,18 +1267,6 @@ async function incorporateCompilationCache() {
1214
1267
  const result2 = await loaderChannel.send("getCompilationCache", {});
1215
1268
  addToCompilationCache(result2.cache);
1216
1269
  }
1217
- async function configureESMLoader() {
1218
- if (!loaderChannel)
1219
- return;
1220
- await loaderChannel.send("setSingleTSConfig", { tsconfig: singleTSConfig() });
1221
- await loaderChannel.send("addToCompilationCache", { cache: serializeCompilationCache() });
1222
- }
1223
- async function configureESMLoaderTransformConfig() {
1224
- if (!loaderChannel)
1225
- return;
1226
- await loaderChannel.send("setSingleTSConfig", { tsconfig: singleTSConfig() });
1227
- await loaderChannel.send("setTransformConfig", { config: transformConfig() });
1228
- }
1229
1270
 
1230
1271
  // packages/playwright/src/common/configLoader.ts
1231
1272
  var { isRegExp: isRegExp2 } = require("playwright-core/lib/coreBundle").iso;
@@ -1295,12 +1336,7 @@ async function loadUserConfig(location) {
1295
1336
  return object;
1296
1337
  }
1297
1338
  async function loadConfig(location, overrides, ignoreProjectDependencies = false, metadata) {
1298
- if (!registerESMLoader()) {
1299
- if (location.resolvedConfigFile && fileIsModule(location.resolvedConfigFile))
1300
- throw errorWithFile(location.resolvedConfigFile, `Playwright requires Node.js 18.19 or higher to load esm modules. Please update your version of Node.js.`);
1301
- }
1302
- setSingleTSConfig(overrides?.tsconfig);
1303
- await configureESMLoader();
1339
+ await setSingleTSConfig(overrides?.tsconfig);
1304
1340
  const userConfig = await loadUserConfig(location);
1305
1341
  validateConfig(location.resolvedConfigFile || "<default config>", userConfig);
1306
1342
  const fullConfig = new FullConfigInternal(location, userConfig, overrides || {}, metadata);
@@ -1314,10 +1350,9 @@ async function loadConfig(location, overrides, ignoreProjectDependencies = false
1314
1350
  const babelPlugins = userConfig["@playwright/test"]?.babelPlugins || [];
1315
1351
  const external = userConfig.build?.external || [];
1316
1352
  const jsxImportSource = import_path7.default.dirname(require.resolve("playwright"));
1317
- setTransformConfig({ babelPlugins, external, jsxImportSource });
1353
+ await setTransformConfig({ babelPlugins, external, jsxImportSource });
1318
1354
  if (!overrides?.tsconfig)
1319
- setSingleTSConfig(fullConfig?.singleTSConfigPath);
1320
- await configureESMLoaderTransformConfig();
1355
+ await setSingleTSConfig(fullConfig?.singleTSConfigPath);
1321
1356
  return fullConfig;
1322
1357
  }
1323
1358
  function validateConfig(file2, config) {
@@ -1424,7 +1459,7 @@ function validateConfig(file2, config) {
1424
1459
  if ("tsconfig" in config && config.tsconfig !== void 0) {
1425
1460
  if (typeof config.tsconfig !== "string")
1426
1461
  throw errorWithFile(file2, `config.tsconfig must be a string`);
1427
- if (!import_fs6.default.existsSync(import_path7.default.resolve(file2, "..", config.tsconfig)))
1462
+ if (!import_fs7.default.existsSync(import_path7.default.resolve(file2, "..", config.tsconfig)))
1428
1463
  throw errorWithFile(file2, `config.tsconfig does not exist`);
1429
1464
  }
1430
1465
  }
@@ -1493,7 +1528,7 @@ function resolveConfigLocation(configFile) {
1493
1528
  }
1494
1529
  function resolveConfigFile2(configFileOrDirectory) {
1495
1530
  const resolveConfig = (configFile) => {
1496
- if (import_fs6.default.existsSync(configFile))
1531
+ if (import_fs7.default.existsSync(configFile))
1497
1532
  return configFile;
1498
1533
  };
1499
1534
  const resolveConfigFileFromDirectory = (directory) => {
@@ -1503,9 +1538,9 @@ function resolveConfigFile2(configFileOrDirectory) {
1503
1538
  return configFile;
1504
1539
  }
1505
1540
  };
1506
- if (!import_fs6.default.existsSync(configFileOrDirectory))
1541
+ if (!import_fs7.default.existsSync(configFileOrDirectory))
1507
1542
  throw new Error(`${configFileOrDirectory} does not exist`);
1508
- if (import_fs6.default.statSync(configFileOrDirectory).isDirectory()) {
1543
+ if (import_fs7.default.statSync(configFileOrDirectory).isDirectory()) {
1509
1544
  const configFile = resolveConfigFileFromDirectory(configFileOrDirectory);
1510
1545
  if (configFile)
1511
1546
  return configFile;
@@ -1801,7 +1836,7 @@ __export(ipc_exports, {
1801
1836
  stdioChunkToParams: () => stdioChunkToParams,
1802
1837
  toTestInfoErrorPayload: () => toTestInfoErrorPayload
1803
1838
  });
1804
- var import_util6 = __toESM(require("util"));
1839
+ var import_util7 = __toESM(require("util"));
1805
1840
  function serializeConfig(config, passCompilationCache) {
1806
1841
  const result2 = {
1807
1842
  location: { configDir: config.configDir, resolvedConfigFile: config.config.configFile },
@@ -1818,7 +1853,7 @@ function stdioChunkToParams(chunk) {
1818
1853
  if (chunk instanceof Uint8Array)
1819
1854
  return { buffer: Buffer.from(chunk).toString("base64") };
1820
1855
  if (typeof chunk !== "string")
1821
- return { text: import_util6.default.inspect(chunk) };
1856
+ return { text: import_util7.default.inspect(chunk) };
1822
1857
  return { text: chunk };
1823
1858
  }
1824
1859
  function toTestInfoErrorPayload(error) {
@@ -2224,7 +2259,8 @@ var TestTypeImpl = class _TestTypeImpl {
2224
2259
  `- You are calling ${title} in a configuration file.`,
2225
2260
  `- You are calling ${title} in a file that is imported by the configuration file.`,
2226
2261
  `- You have two different versions of @playwright/test. This usually happens`,
2227
- ` when one of the dependencies in your package.json depends on @playwright/test.`
2262
+ ` when one of the dependencies in your package.json depends on @playwright/test.`,
2263
+ `- You are calling ${title} from an async test.describe() block. Only sync ones are supported.`
2228
2264
  ].join("\n"));
2229
2265
  }
2230
2266
  return suite;
@@ -2454,6 +2490,8 @@ var TimeoutError = class extends Error {
2454
2490
 
2455
2491
  // packages/playwright/src/isomorphic/teleReceiver.ts
2456
2492
  var baseFullConfig = {
2493
+ argv: [],
2494
+ failOnFlakyTests: false,
2457
2495
  forbidOnly: false,
2458
2496
  fullyParallel: false,
2459
2497
  globalSetup: null,
@@ -2818,7 +2856,7 @@ __export(testLoader_exports, {
2818
2856
  loadTestFile: () => loadTestFile
2819
2857
  });
2820
2858
  var import_path9 = __toESM(require("path"));
2821
- var import_util10 = __toESM(require("util"));
2859
+ var import_util11 = __toESM(require("util"));
2822
2860
  var import_globals3 = require("../globals");
2823
2861
  var defaultTimeout2 = 3e4;
2824
2862
  var cachedFileSuites = /* @__PURE__ */ new Map();
@@ -2830,10 +2868,8 @@ async function loadTestFile(file2, config, testErrors) {
2830
2868
  suite.location = { file: file2, line: 0, column: 0 };
2831
2869
  suite._tags = [...config.config.tags];
2832
2870
  (0, import_globals3.setCurrentlyLoadingFileSuite)(suite);
2833
- if (!(0, import_globals3.isWorkerProcess)()) {
2834
- startCollectingFileDeps();
2871
+ if (!(0, import_globals3.isWorkerProcess)())
2835
2872
  await startCollectingFileDeps2();
2836
- }
2837
2873
  try {
2838
2874
  await requireOrImport(file2);
2839
2875
  cachedFileSuites.set(file2, suite);
@@ -2843,10 +2879,8 @@ async function loadTestFile(file2, config, testErrors) {
2843
2879
  testErrors.push(serializeLoadError(file2, e));
2844
2880
  } finally {
2845
2881
  (0, import_globals3.setCurrentlyLoadingFileSuite)(void 0);
2846
- if (!(0, import_globals3.isWorkerProcess)()) {
2847
- stopCollectingFileDeps(file2);
2882
+ if (!(0, import_globals3.isWorkerProcess)())
2848
2883
  await stopCollectingFileDeps2(file2);
2849
- }
2850
2884
  }
2851
2885
  {
2852
2886
  const files = /* @__PURE__ */ new Set();
@@ -2872,7 +2906,7 @@ function serializeLoadError(file2, error) {
2872
2906
  } : void 0;
2873
2907
  return result2;
2874
2908
  }
2875
- return { value: import_util10.default.inspect(error) };
2909
+ return { value: import_util11.default.inspect(error) };
2876
2910
  }
2877
2911
  // Annotate the CommonJS export names for ESM import in node:
2878
2912
  0 && (module.exports = {
@@ -2883,7 +2917,6 @@ function serializeLoadError(file2, error) {
2883
2917
  config,
2884
2918
  configLoader,
2885
2919
  defineConfig,
2886
- esm,
2887
2920
  fixtures,
2888
2921
  ipc,
2889
2922
  mergeTests,
@@ -1,10 +1,9 @@
1
1
  # packages/playwright/lib/common/index.js
2
- # total: 111.2 KB
2
+ # total: 112.8 KB
3
3
 
4
4
  ## Inlined (20)
5
- 11.6 KB packages/playwright/src/common/config.ts
6
- 13.7 KB packages/playwright/src/common/configLoader.ts
7
- 2.1 KB packages/playwright/src/common/esmLoaderHost.ts
5
+ 11.7 KB packages/playwright/src/common/config.ts
6
+ 13.4 KB packages/playwright/src/common/configLoader.ts
8
7
  10.9 KB packages/playwright/src/common/fixtures.ts
9
8
  0.8 KB packages/playwright/src/common/index.ts
10
9
  1.3 KB packages/playwright/src/common/ipc.ts
@@ -12,16 +11,17 @@
12
11
  3.7 KB packages/playwright/src/common/process.ts
13
12
  4.7 KB packages/playwright/src/common/suiteUtils.ts
14
13
  7.9 KB packages/playwright/src/common/test.ts
15
- 2.1 KB packages/playwright/src/common/testLoader.ts
16
- 12.5 KB packages/playwright/src/common/testType.ts
14
+ 2.0 KB packages/playwright/src/common/testLoader.ts
15
+ 12.6 KB packages/playwright/src/common/testType.ts
17
16
  1.2 KB packages/playwright/src/common/validators.ts
18
17
  1.3 KB packages/playwright/src/isomorphic/teleReceiver.ts
19
18
  9.6 KB packages/playwright/src/transform/compilationCache.ts
19
+ 1.6 KB packages/playwright/src/transform/esmLoaderSync.ts
20
20
  1.1 KB packages/playwright/src/transform/pirates.ts
21
21
  1.1 KB packages/playwright/src/transform/portTransport.ts
22
- 10.2 KB packages/playwright/src/transform/transform.ts
22
+ 12.3 KB packages/playwright/src/transform/transform.ts
23
23
  2.9 KB packages/playwright/src/transform/tsconfig-loader.ts
24
- 7.5 KB packages/playwright/src/util.ts
24
+ 7.8 KB packages/playwright/src/util.ts
25
25
 
26
26
  ## External (9)
27
27
  ../globals