playwright 1.62.1 → 1.65.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.
@@ -63,22 +63,23 @@ __export(compilationCache_exports, {
63
63
  dependenciesForTestFile: () => dependenciesForTestFile,
64
64
  fileDependenciesForTest: () => fileDependenciesForTest,
65
65
  getFromCompilationCache: () => getFromCompilationCache,
66
- getUserData: () => getUserData,
67
66
  installSourceMapSupport: () => installSourceMapSupport,
68
67
  internalDependenciesForTestFile: () => internalDependenciesForTestFile,
68
+ recordResolvedFile: () => recordResolvedFile,
69
69
  serializeCompilationCache: () => serializeCompilationCache,
70
- setExternalDependencies: () => setExternalDependencies,
71
70
  startCollectingFileDeps: () => startCollectingFileDeps,
72
71
  stopCollectingFileDeps: () => stopCollectingFileDeps
73
72
  });
74
73
  var import_fs = __toESM(require("fs"));
75
74
  var import_os = __toESM(require("os"));
76
75
  var import_path = __toESM(require("path"));
76
+ var import_url = __toESM(require("url"));
77
77
  var import_globals = require("../globals");
78
78
  var import_package = require("../package");
79
79
  var sourceMapSupport = require("playwright-core/lib/utilsBundle").sourceMapSupport;
80
+ var { MultiMap } = require("playwright-core/lib/coreBundle").iso;
80
81
  var { calculateSha1 } = require("playwright-core/lib/coreBundle").utils;
81
- var cacheDir = process.env.PWTEST_CACHE_DIR || (() => {
82
+ var cacheDir = process.env.PLAYWRIGHT_TRANSFORM_CACHE_DIR || process.env.PWTEST_CACHE_DIR || (() => {
82
83
  if (process.platform === "win32")
83
84
  return import_path.default.join(import_os.default.tmpdir(), `playwright-transform-cache`);
84
85
  return import_path.default.join(import_os.default.tmpdir(), `playwright-transform-cache-` + process.geteuid?.());
@@ -86,7 +87,6 @@ var cacheDir = process.env.PWTEST_CACHE_DIR || (() => {
86
87
  var sourceMaps = /* @__PURE__ */ new Map();
87
88
  var memoryCache = /* @__PURE__ */ new Map();
88
89
  var fileDependencies = /* @__PURE__ */ new Map();
89
- var externalDependencies = /* @__PURE__ */ new Map();
90
90
  function installSourceMapSupport() {
91
91
  Error.stackTraceLimit = 200;
92
92
  sourceMapSupport.install({
@@ -149,25 +149,22 @@ function getFromCompilationCache(filename, contentHash, moduleUrl) {
149
149
  const cachePath = calculateCachePath(filename, cacheFolderName, hashPrefix);
150
150
  const codePath = cachePath + ".js";
151
151
  const sourceMapPath = cachePath + ".map";
152
- const dataPath = cachePath + ".data";
153
152
  try {
154
153
  const cachedCode = readCodeCache(codePath);
155
- const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, dataPath, moduleUrl });
154
+ const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, moduleUrl });
156
155
  return { cachedCode, serializedCache };
157
156
  } catch {
158
157
  }
159
158
  return {
160
- addToCache: (code, map, data) => {
159
+ addToCache: (code, map) => {
161
160
  if ((0, import_globals.isWorkerProcess)())
162
161
  return {};
163
162
  clearOldCacheEntries(cacheFolderName, filePathHash);
164
163
  import_fs.default.mkdirSync(import_path.default.dirname(cachePath), { recursive: true });
165
164
  if (map)
166
165
  import_fs.default.writeFileSync(sourceMapPath, JSON.stringify(map), "utf8");
167
- if (data.size)
168
- import_fs.default.writeFileSync(dataPath, JSON.stringify(Object.fromEntries(data.entries()), void 0, 2), "utf8");
169
166
  writeCodeCache(codePath, code);
170
- const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, dataPath, moduleUrl });
167
+ const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, moduleUrl });
171
168
  return { serializedCache };
172
169
  }
173
170
  };
@@ -176,8 +173,7 @@ function serializeCompilationCache() {
176
173
  return {
177
174
  sourceMaps: [...sourceMaps.entries()],
178
175
  memoryCache: [...memoryCache.entries()],
179
- fileDependencies: [...fileDependencies.entries()].map(([filename, deps]) => [filename, [...deps]]),
180
- externalDependencies: [...externalDependencies.entries()].map(([filename, deps]) => [filename, [...deps]])
176
+ fileDependencies: [...fileDependencies.entries()].map(([filename, deps]) => [filename, [...deps]])
181
177
  };
182
178
  }
183
179
  function addToCompilationCache(payload) {
@@ -189,10 +185,6 @@ function addToCompilationCache(payload) {
189
185
  const existing = fileDependencies.get(entry[0]) || [];
190
186
  fileDependencies.set(entry[0], /* @__PURE__ */ new Set([...entry[1], ...existing]));
191
187
  }
192
- for (const entry of payload.externalDependencies) {
193
- const existing = externalDependencies.get(entry[0]) || [];
194
- externalDependencies.set(entry[0], /* @__PURE__ */ new Set([...entry[1], ...existing]));
195
- }
196
188
  }
197
189
  function calculateFilePathHash(filePath) {
198
190
  return calculateSha1(filePath).substring(0, 10);
@@ -211,12 +203,30 @@ function clearOldCacheEntries(cacheFolderName, filePathHash) {
211
203
  }
212
204
  }
213
205
  var depsCollector2;
206
+ var importGraph = new MultiMap();
207
+ function recordResolvedFile(resolvedUrl, parentUrl) {
208
+ if ((0, import_globals.isWorkerProcess)() || !resolvedUrl?.startsWith("file://"))
209
+ return;
210
+ const child = import_url.default.fileURLToPath(resolvedUrl);
211
+ depsCollector2?.add(child);
212
+ if (!parentUrl?.startsWith("file://"))
213
+ return;
214
+ const parent = import_url.default.fileURLToPath(parentUrl);
215
+ if (!belongsToNodeModules(parent) && !importGraph.hasValue(parent, child))
216
+ importGraph.set(parent, child);
217
+ }
214
218
  function startCollectingFileDeps() {
215
219
  depsCollector2 = /* @__PURE__ */ new Set();
216
220
  }
217
- function stopCollectingFileDeps(filename) {
221
+ function stopCollectingFileDeps(filename, additionalDeps = []) {
218
222
  if (!depsCollector2)
219
223
  return;
224
+ for (const dep of additionalDeps)
225
+ depsCollector2.add(dep);
226
+ for (const dep of depsCollector2) {
227
+ for (const child of importGraph.get(dep))
228
+ depsCollector2.add(child);
229
+ }
220
230
  depsCollector2.delete(filename);
221
231
  for (const dep of depsCollector2) {
222
232
  if (belongsToNodeModules(dep))
@@ -228,10 +238,6 @@ function stopCollectingFileDeps(filename) {
228
238
  function currentFileDepsCollector() {
229
239
  return depsCollector2;
230
240
  }
231
- function setExternalDependencies(filename, deps) {
232
- const depsSet = new Set(deps.filter((dep) => !belongsToNodeModules(dep) && dep !== filename));
233
- externalDependencies.set(filename, depsSet);
234
- }
235
241
  function fileDependenciesForTest() {
236
242
  return Object.fromEntries([...fileDependencies.entries()].map((entry) => [import_path.default.basename(entry[0]), [...entry[1]].map((f) => import_path.default.basename(f)).sort()]));
237
243
  }
@@ -243,16 +249,6 @@ function collectAffectedTestFiles(changedFile, testFileCollector) {
243
249
  if (deps.has(changedFile))
244
250
  testFileCollector.add(testFile);
245
251
  }
246
- for (const [importingFile, depsOfImportingFile] of externalDependencies) {
247
- if (depsOfImportingFile.has(changedFile)) {
248
- if (isTestFile(importingFile))
249
- testFileCollector.add(importingFile);
250
- for (const [testFile, depsOfTestFile] of fileDependencies) {
251
- if (depsOfTestFile.has(importingFile))
252
- testFileCollector.add(testFile);
253
- }
254
- }
255
- }
256
252
  }
257
253
  function affectedTestFiles(changes) {
258
254
  const result2 = /* @__PURE__ */ new Set();
@@ -264,15 +260,7 @@ function internalDependenciesForTestFile(filename) {
264
260
  return fileDependencies.get(filename);
265
261
  }
266
262
  function dependenciesForTestFile(filename) {
267
- const result2 = /* @__PURE__ */ new Set();
268
- for (const testDependency of fileDependencies.get(filename) || []) {
269
- result2.add(testDependency);
270
- for (const externalDependency of externalDependencies.get(testDependency) || [])
271
- result2.add(externalDependency);
272
- }
273
- for (const dep of externalDependencies.get(filename) || [])
274
- result2.add(dep);
275
- return result2;
263
+ return fileDependencies.get(filename) || /* @__PURE__ */ new Set();
276
264
  }
277
265
  var kPlaywrightInternalPrefix = import_package.packageRoot;
278
266
  function belongsToNodeModules(file2) {
@@ -282,19 +270,6 @@ function belongsToNodeModules(file2) {
282
270
  return true;
283
271
  return false;
284
272
  }
285
- async function getUserData(pluginName) {
286
- const result2 = /* @__PURE__ */ new Map();
287
- for (const [fileName2, cache] of memoryCache) {
288
- if (!cache.dataPath)
289
- continue;
290
- if (!import_fs.default.existsSync(cache.dataPath))
291
- continue;
292
- const data = JSON.parse(await import_fs.default.promises.readFile(cache.dataPath, "utf8"));
293
- if (data[pluginName])
294
- result2.set(fileName2, data[pluginName]);
295
- }
296
- return result2;
297
- }
298
273
 
299
274
  // packages/playwright/src/common/config.ts
300
275
  var config_exports = {};
@@ -564,8 +539,9 @@ var FullConfigInternal = class {
564
539
  metadata: metadata ?? userConfig.metadata,
565
540
  preserveOutput: takeFirst(userConfig.preserveOutput, "always"),
566
541
  projects: [],
542
+ filteredProjects: [],
567
543
  quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false),
568
- reporter: takeFirst(configCLIOverrides.reporter, resolveReporters(userConfig.reporter, configDir), [[defaultReporter]]),
544
+ reporter: [...takeFirst(configCLIOverrides.reporter, resolveReporters(userConfig.reporter, configDir), [[defaultReporter]]), ...configCLIOverrides.additionalReporters ?? []],
569
545
  reportSlowTests: takeFirst(userConfig.reportSlowTests, {
570
546
  max: 5,
571
547
  threshold: 3e5
@@ -573,10 +549,10 @@ var FullConfigInternal = class {
573
549
  }),
574
550
  shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null),
575
551
  tags: globalTags,
576
- updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, "missing"),
552
+ updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, "default"),
577
553
  updateSourceMethod: takeFirst(configCLIOverrides.updateSourceMethod, userConfig.updateSourceMethod, "patch"),
578
554
  version: import_package2.packageJSON.version,
579
- workers: resolveWorkers(takeFirst(configCLIOverrides.debug || configCLIOverrides.pause ? 1 : void 0, configCLIOverrides.workers, userConfig.workers, "50%")),
555
+ workers: resolveWorkers(takeFirst(configCLIOverrides.debug ? 1 : void 0, configCLIOverrides.workers, userConfig.workers, "50%")),
580
556
  webServer: null
581
557
  };
582
558
  for (const key in userConfig) {
@@ -599,6 +575,7 @@ var FullConfigInternal = class {
599
575
  resolveProjectDependencies(this.projects);
600
576
  this._assignUniqueProjectIds(this.projects);
601
577
  this.config.projects = this.projects.map((p) => p.project);
578
+ this.config.filteredProjects = this.config.projects;
602
579
  }
603
580
  _assignUniqueProjectIds(projects) {
604
581
  const usedNames = /* @__PURE__ */ new Set();
@@ -623,6 +600,10 @@ var FullProjectInternal = class {
623
600
  this.fullConfig = fullConfig;
624
601
  const testDir = takeFirst(pathResolve(configDir, projectConfig.testDir), pathResolve(configDir, config.testDir), fullConfig.configDir);
625
602
  this.snapshotPathTemplate = takeFirst(projectConfig.snapshotPathTemplate, config.snapshotPathTemplate);
603
+ const use = mergeObjects(config.use, projectConfig.use, configCLIOverrides.use);
604
+ const configTrace = takeFirst(projectConfig.use?.trace, config.use?.trace);
605
+ if (typeof configCLIOverrides.use?.trace === "string" && typeof configTrace === "object" && configTrace)
606
+ use.trace = { ...configTrace, mode: configCLIOverrides.use.trace };
626
607
  this.project = {
627
608
  grep: takeFirst(projectConfig.grep, config.grep, defaultGrep),
628
609
  grepInvert: takeFirst(projectConfig.grepInvert, config.grepInvert, null),
@@ -638,7 +619,7 @@ var FullProjectInternal = class {
638
619
  testIgnore: takeFirst(projectConfig.testIgnore, config.testIgnore, []),
639
620
  testMatch: takeFirst(projectConfig.testMatch, config.testMatch, "**/*.@(spec|test).?(c|m)[jt]s?(x)"),
640
621
  timeout: takeFirst(configCLIOverrides.debug === "inspector" ? 0 : void 0, configCLIOverrides.timeout, projectConfig.timeout, config.timeout, defaultTimeout),
641
- use: mergeObjects(config.use, projectConfig.use, configCLIOverrides.use),
622
+ use,
642
623
  dependencies: projectConfig.dependencies || [],
643
624
  teardown: projectConfig.teardown,
644
625
  ignoreSnapshots: takeFirst(configCLIOverrides.ignoreSnapshots, projectConfig.ignoreSnapshots, config.ignoreSnapshots, false)
@@ -653,6 +634,7 @@ var FullProjectInternal = class {
653
634
  this.workers = projectConfig.workers ? resolveWorkers(projectConfig.workers) : void 0;
654
635
  if (configCLIOverrides.debug && this.workers)
655
636
  this.workers = 1;
637
+ this.default = projectConfig.default ?? true;
656
638
  }
657
639
  };
658
640
  function pathResolve(baseDir, relative) {
@@ -729,7 +711,7 @@ function toReporters(reporters) {
729
711
  return [[reporters]];
730
712
  return reporters;
731
713
  }
732
- var builtInReporters = ["list", "line", "dot", "json", "junit", "null", "github", "html", "blob"];
714
+ var builtInReporters = ["list", "line", "dot", "failures", "json", "junit", "null", "github", "html", "blob", "perfetto", "coverage"];
733
715
  function resolveScript(id, rootDir) {
734
716
  if (!id)
735
717
  return void 0;
@@ -761,12 +743,14 @@ var import_path7 = __toESM(require("path"));
761
743
  // packages/playwright/src/transform/transform.ts
762
744
  var transform_exports = {};
763
745
  __export(transform_exports, {
746
+ hasTransformedExtension: () => hasTransformedExtension,
764
747
  incorporateCompilationCache: () => incorporateCompilationCache,
748
+ installTransformIfNeeded: () => installTransformIfNeeded,
749
+ isStyleFile: () => isStyleFile,
765
750
  requireOrImport: () => requireOrImport,
766
751
  resolveHook: () => resolveHook,
767
752
  setSingleTSConfig: () => setSingleTSConfig,
768
753
  setTransformConfig: () => setTransformConfig,
769
- setTransformData: () => setTransformData,
770
754
  shouldTransform: () => shouldTransform,
771
755
  startCollectingFileDeps: () => startCollectingFileDeps2,
772
756
  stopCollectingFileDeps: () => stopCollectingFileDeps2,
@@ -776,13 +760,14 @@ __export(transform_exports, {
776
760
  var import_fs6 = __toESM(require("fs"));
777
761
  var import_module2 = __toESM(require("module"));
778
762
  var import_path6 = __toESM(require("path"));
779
- var import_url2 = __toESM(require("url"));
763
+ var import_url3 = __toESM(require("url"));
780
764
  var import_crypto = __toESM(require("crypto"));
781
765
 
782
766
  // packages/playwright/src/transform/tsconfig-loader.ts
783
767
  var import_path4 = __toESM(require("path"));
784
768
  var import_fs4 = __toESM(require("fs"));
785
769
  var json5 = require("playwright-core/lib/utilsBundle").json5;
770
+ var jsxOptionNames = ["jsx", "jsxFactory", "jsxFragmentFactory", "jsxImportSource"];
786
771
  function loadTsConfig(configPath) {
787
772
  try {
788
773
  const references = [];
@@ -794,13 +779,26 @@ ${e.message}`);
794
779
  }
795
780
  }
796
781
  function resolveConfigFile(baseConfigFile, referencedConfigFile) {
797
- if (!referencedConfigFile.endsWith(".json"))
798
- referencedConfigFile += ".json";
799
782
  const currentDir = import_path4.default.dirname(baseConfigFile);
800
- let resolvedConfigFile = import_path4.default.resolve(currentDir, referencedConfigFile);
801
- if (referencedConfigFile.includes("/") && referencedConfigFile.includes(".") && !import_fs4.default.existsSync(resolvedConfigFile))
802
- resolvedConfigFile = import_path4.default.join(currentDir, "node_modules", referencedConfigFile);
803
- return resolvedConfigFile;
783
+ const referencedFile = referencedConfigFile.endsWith(".json") ? referencedConfigFile : referencedConfigFile + ".json";
784
+ const resolvedConfigFile = import_path4.default.resolve(currentDir, referencedFile);
785
+ if (import_fs4.default.existsSync(resolvedConfigFile) || referencedConfigFile.startsWith(".") || import_path4.default.isAbsolute(referencedConfigFile))
786
+ return resolvedConfigFile;
787
+ const packageDir = import_path4.default.join(currentDir, "node_modules", referencedConfigFile);
788
+ const candidates = [import_path4.default.join(currentDir, "node_modules", referencedFile)];
789
+ const packageTsconfig = packageJsonTsconfigField(import_path4.default.join(packageDir, "package.json"));
790
+ if (packageTsconfig)
791
+ candidates.push(import_path4.default.resolve(packageDir, packageTsconfig));
792
+ candidates.push(import_path4.default.join(packageDir, "tsconfig.json"));
793
+ return candidates.find((candidate) => import_fs4.default.existsSync(candidate)) ?? resolvedConfigFile;
794
+ }
795
+ function packageJsonTsconfigField(packageJsonFile) {
796
+ try {
797
+ const tsconfig = JSON.parse(import_fs4.default.readFileSync(packageJsonFile, "utf8")).tsconfig;
798
+ return typeof tsconfig === "string" ? tsconfig : void 0;
799
+ } catch {
800
+ return void 0;
801
+ }
804
802
  }
805
803
  function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */ new Map()) {
806
804
  if (visited.has(configFilePath))
@@ -822,6 +820,14 @@ function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */
822
820
  }
823
821
  if (parsedConfig.compilerOptions?.allowJs !== void 0)
824
822
  result2.allowJs = parsedConfig.compilerOptions.allowJs;
823
+ for (const name of jsxOptionNames) {
824
+ if (parsedConfig.compilerOptions?.[name] !== void 0)
825
+ result2[name] = parsedConfig.compilerOptions[name];
826
+ }
827
+ if (parsedConfig.compilerOptions?.target !== void 0)
828
+ result2.target = parsedConfig.compilerOptions.target;
829
+ if (parsedConfig.compilerOptions?.useDefineForClassFields !== void 0)
830
+ result2.useDefineForClassFields = parsedConfig.compilerOptions.useDefineForClassFields;
825
831
  if (parsedConfig.compilerOptions?.paths !== void 0) {
826
832
  result2.paths = {
827
833
  mapping: parsedConfig.compilerOptions.paths,
@@ -852,18 +858,17 @@ var import_package3 = require("../package");
852
858
 
853
859
  // packages/playwright/src/transform/esmLoaderSync.ts
854
860
  var import_fs5 = __toESM(require("fs"));
855
- var import_url = __toESM(require("url"));
861
+ var import_url2 = __toESM(require("url"));
856
862
  function resolve(specifier, context, nextResolve) {
857
863
  if (context.parentURL && context.parentURL.startsWith("file://")) {
858
- const filename = import_url.default.fileURLToPath(context.parentURL);
864
+ const filename = import_url2.default.fileURLToPath(context.parentURL);
859
865
  const resolved = resolveHook(filename, specifier);
860
866
  if (resolved !== void 0) {
861
- specifier = new Set(context.conditions).has("import") ? import_url.default.pathToFileURL(resolved).toString() : resolved;
867
+ specifier = new Set(context.conditions).has("import") ? import_url2.default.pathToFileURL(resolved).toString() : resolved;
862
868
  }
863
869
  }
864
870
  const result2 = nextResolve(specifier, context);
865
- if (result2?.url && result2.url.startsWith("file://"))
866
- currentFileDepsCollector()?.add(import_url.default.fileURLToPath(result2.url));
871
+ recordResolvedFile(result2?.url, context.parentURL);
867
872
  return result2;
868
873
  }
869
874
  var kSupportedFormats = /* @__PURE__ */ new Map([
@@ -880,8 +885,10 @@ function load(moduleUrl, context, nextLoad) {
880
885
  return nextLoad(moduleUrl, context);
881
886
  if (!moduleUrl.startsWith("file://"))
882
887
  return nextLoad(moduleUrl, context);
883
- const filename = import_url.default.fileURLToPath(moduleUrl);
884
- if (!shouldTransform(filename))
888
+ const filename = import_url2.default.fileURLToPath(moduleUrl);
889
+ if (isStyleFile(filename))
890
+ return { format: "commonjs", source: "", shortCircuit: true };
891
+ if (!shouldTransform(filename) || !hasTransformedExtension(filename))
885
892
  return nextLoad(moduleUrl, context);
886
893
  const isRequire = !new Set(context.conditions).has("import");
887
894
  const format = isRequire ? "commonjs" : kSupportedFormats.get(context.format) || (fileIsModule(filename) ? "module" : "commonjs");
@@ -968,7 +975,6 @@ var sourceMapSupport2 = require("playwright-core/lib/utilsBundle").sourceMapSupp
968
975
  var version = import_package3.packageJSON.version;
969
976
  var cachedTSConfigs = /* @__PURE__ */ new Map();
970
977
  var _transformConfig = {
971
- babelPlugins: [],
972
978
  external: []
973
979
  };
974
980
  var _externalMatcher = () => false;
@@ -991,9 +997,21 @@ function validateTsConfig(tsconfig) {
991
997
  return {
992
998
  allowJs: !!tsconfig.allowJs,
993
999
  pathsBase,
994
- paths: Object.entries(tsconfig.paths?.mapping || {}).map(([key, values]) => ({ key, values })).concat(pathsFallback)
1000
+ paths: Object.entries(tsconfig.paths?.mapping || {}).map(([key, values]) => ({ key, values })).concat(pathsFallback),
1001
+ jsx: tsconfig.jsx ? {
1002
+ jsx: tsconfig.jsx.toLowerCase(),
1003
+ jsxFactory: tsconfig.jsxFactory,
1004
+ jsxFragmentFactory: tsconfig.jsxFragmentFactory,
1005
+ jsxImportSource: tsconfig.jsxImportSource
1006
+ } : void 0,
1007
+ useDefineForClassFields: tsconfig.useDefineForClassFields ?? (tsconfig.target ? targetUsesDefineForClassFields(tsconfig.target) : void 0)
995
1008
  };
996
1009
  }
1010
+ function targetUsesDefineForClassFields(target) {
1011
+ const normalized = target.toLowerCase();
1012
+ const year = normalized.match(/^es(\d{4})$/)?.[1];
1013
+ return normalized === "esnext" || !!year && +year >= 2022;
1014
+ }
997
1015
  function loadAndValidateTsconfigsForFile(file2) {
998
1016
  if (_singleTSConfigPath && !_singleTSConfig)
999
1017
  _singleTSConfig = loadTsConfig(_singleTSConfigPath).map(validateTsConfig);
@@ -1088,47 +1106,48 @@ function resolveHook(filename, specifier) {
1088
1106
  return resolveImportSpecifierAfterMapping(specifier, false);
1089
1107
  }
1090
1108
  }
1109
+ var kStyleExtensions = [".css", ".less", ".scss"];
1110
+ function isStyleFile(filename) {
1111
+ return kStyleExtensions.includes(import_path6.default.extname(filename));
1112
+ }
1091
1113
  function shouldTransform(filename) {
1092
1114
  if (_externalMatcher(filename))
1093
1115
  return false;
1094
1116
  return !belongsToNodeModules(filename);
1095
1117
  }
1096
- var transformData;
1097
- function setTransformData(pluginName, value) {
1098
- transformData.set(pluginName, value);
1118
+ var kTransformedExtensions = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".mts", ".cjs", ".cts"];
1119
+ function hasTransformedExtension(filename) {
1120
+ const extension = import_path6.default.extname(filename);
1121
+ return !extension || kTransformedExtensions.includes(extension);
1099
1122
  }
1100
1123
  function transformHook(originalCode, filename, moduleUrl) {
1101
1124
  const hasPreprocessor = process.env.PW_TEST_SOURCE_TRANSFORM && process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE && process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE.split(pathSeparator).some((f) => filename.startsWith(f));
1102
- const pluginsPrologue = _transformConfig.babelPlugins;
1103
1125
  const pluginsEpilogue = hasPreprocessor ? [[process.env.PW_TEST_SOURCE_TRANSFORM]] : [];
1104
- const hash = calculateHash(originalCode, filename, !!moduleUrl, pluginsPrologue, pluginsEpilogue);
1126
+ const tsconfigs = loadAndValidateTsconfigsForFile(filename);
1127
+ const jsx = tsconfigs.find((tsconfig) => tsconfig.jsx)?.jsx;
1128
+ const useDefineForClassFields = tsconfigs.find((tsconfig) => tsconfig.useDefineForClassFields !== void 0)?.useDefineForClassFields ?? true;
1129
+ const hash = calculateHash(originalCode, filename, !!moduleUrl, pluginsEpilogue, useDefineForClassFields, jsx);
1105
1130
  const { cachedCode, addToCache, serializedCache } = getFromCompilationCache(filename, hash, moduleUrl);
1106
1131
  if (cachedCode !== void 0)
1107
1132
  return { code: cachedCode, serializedCache };
1108
1133
  process.env.BROWSERSLIST_IGNORE_OLD_DATA = "true";
1109
1134
  const { babelTransform } = require((0, import_package3.libPath)("transform", "babelBundle"));
1110
- transformData = /* @__PURE__ */ new Map();
1111
- const setTransformDataForPlugin = (key, value) => transformData.set(key, value);
1112
- const wrappedPrologue = pluginsPrologue.map(([name, opts]) => [
1113
- name,
1114
- { ...opts || {}, setTransformData: setTransformDataForPlugin }
1115
- ]);
1116
- const babelResult = babelTransform(originalCode, filename, !!moduleUrl, wrappedPrologue, pluginsEpilogue, _transformConfig.jsxImportSource);
1135
+ const babelResult = babelTransform(originalCode, filename, !!moduleUrl, pluginsEpilogue, useDefineForClassFields, jsx);
1117
1136
  if (!babelResult?.code)
1118
1137
  return { code: originalCode, serializedCache };
1119
1138
  const { code, map } = babelResult;
1120
- const added = addToCache(code, map, transformData);
1139
+ const added = addToCache(code, map);
1121
1140
  return { code, serializedCache: added.serializedCache };
1122
1141
  }
1123
- function calculateHash(content, filePath, isModule2, pluginsPrologue, pluginsEpilogue) {
1124
- const hash = import_crypto.default.createHash("sha1").update(isModule2 ? "esm" : "no_esm").update(content).update(filePath).update(version).update(pluginsPrologue.map((p) => p[0]).join(",")).update(pluginsEpilogue.map((p) => p[0]).join(",")).digest("hex");
1142
+ function calculateHash(content, filePath, isModule2, pluginsEpilogue, useDefineForClassFields, jsx) {
1143
+ const hash = import_crypto.default.createHash("sha1").update(isModule2 ? "esm" : "no_esm").update(content).update(filePath).update(version).update(pluginsEpilogue.map((p) => p[0]).join(",")).update(useDefineForClassFields ? "define" : "assign").update(jsx ? JSON.stringify(jsx) : "").digest("hex");
1125
1144
  return hash;
1126
1145
  }
1127
1146
  async function requireOrImport(file) {
1128
1147
  installTransformIfNeeded();
1129
1148
  const isModule = fileIsModule(file);
1130
1149
  if (isModule) {
1131
- const fileName = import_url2.default.pathToFileURL(file);
1150
+ const fileName = import_url3.default.pathToFileURL(file);
1132
1151
  const esmImport = () => eval(`import(${JSON.stringify(fileName)})`);
1133
1152
  if (loaderChannel) {
1134
1153
  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);
@@ -1153,6 +1172,8 @@ function installTransformIfNeeded() {
1153
1172
  if (transformInstalled)
1154
1173
  return;
1155
1174
  transformInstalled = true;
1175
+ if ("Bun" in globalThis)
1176
+ return;
1156
1177
  registerESMLoader();
1157
1178
  installSourceMapSupport();
1158
1179
  if (loaderChannel) {
@@ -1176,7 +1197,11 @@ function installCJSHooks() {
1176
1197
  import_module2.default._resolveFilename = resolveFilename;
1177
1198
  addHook((code, filename) => {
1178
1199
  return transformHook(code, filename).code;
1179
- }, shouldTransform, [".ts", ".tsx", ".js", ".jsx", ".mjs", ".mts", ".cjs", ".cts"]);
1200
+ }, shouldTransform, kTransformedExtensions);
1201
+ const extensions = import_module2.default._extensions;
1202
+ for (const ext of kStyleExtensions)
1203
+ extensions[ext] = () => {
1204
+ };
1180
1205
  }
1181
1206
  var collectCJSDependencies = (module2, dependencies) => {
1182
1207
  module2.children.forEach((child) => {
@@ -1189,26 +1214,40 @@ var collectCJSDependencies = (module2, dependencies) => {
1189
1214
  function wrapFunctionWithLocation(func) {
1190
1215
  return (...args) => {
1191
1216
  const oldPrepareStackTrace = Error.prepareStackTrace;
1192
- Error.prepareStackTrace = (error, stackFrames) => {
1193
- const frame = sourceMapSupport2.wrapCallSite(stackFrames[1]);
1194
- const fileName2 = frame.getFileName();
1195
- const file2 = fileName2 && fileName2.startsWith("file://") ? import_url2.default.fileURLToPath(fileName2) : fileName2;
1196
- return {
1197
- file: file2,
1198
- line: frame.getLineNumber(),
1199
- column: frame.getColumnNumber()
1200
- };
1201
- };
1202
1217
  const oldStackTraceLimit = Error.stackTraceLimit;
1218
+ Error.prepareStackTrace = "Bun" in globalThis ? bunCallerLocation : nodeCallerLocation;
1203
1219
  Error.stackTraceLimit = 2;
1204
1220
  const obj = {};
1205
- Error.captureStackTrace(obj);
1206
- const location = obj.stack;
1207
- Error.stackTraceLimit = oldStackTraceLimit;
1208
- Error.prepareStackTrace = oldPrepareStackTrace;
1221
+ let location;
1222
+ try {
1223
+ Error.captureStackTrace(obj);
1224
+ location = obj.stack;
1225
+ } finally {
1226
+ Error.stackTraceLimit = oldStackTraceLimit;
1227
+ Error.prepareStackTrace = oldPrepareStackTrace;
1228
+ }
1209
1229
  return func(location, ...args);
1210
1230
  };
1211
1231
  }
1232
+ function nodeCallerLocation(error, stackFrames) {
1233
+ const frame = sourceMapSupport2.wrapCallSite(stackFrames[1]);
1234
+ const fileName2 = frame.getFileName();
1235
+ const file2 = fileName2 && fileName2.startsWith("file://") ? import_url3.default.fileURLToPath(fileName2) : fileName2;
1236
+ return {
1237
+ file: file2,
1238
+ line: frame.getLineNumber(),
1239
+ column: frame.getColumnNumber()
1240
+ };
1241
+ }
1242
+ function bunCallerLocation(error, stackFrames) {
1243
+ const frame = stackFrames[1];
1244
+ const position = sourceMapSupport2.mapSourcePosition({ source: frame.getFileName(), line: frame.getLineNumber(), column: frame.getColumnNumber() });
1245
+ return {
1246
+ file: position.source,
1247
+ line: position.line,
1248
+ column: position.column + 1
1249
+ };
1250
+ }
1212
1251
  function isRelativeSpecifier(specifier) {
1213
1252
  return specifier === "." || specifier === ".." || specifier.startsWith("./") || specifier.startsWith("../");
1214
1253
  }
@@ -1219,8 +1258,6 @@ var loaderChannel;
1219
1258
  function registerESMLoader() {
1220
1259
  if (process.env.PW_DISABLE_TS_ESM)
1221
1260
  return;
1222
- if ("Bun" in globalThis)
1223
- return;
1224
1261
  const nodeModule = require("node:module");
1225
1262
  if (nodeModule.registerHooks && !process.env.PLAYWRIGHT_FORCE_ASYNC_LOADER) {
1226
1263
  nodeModule.registerHooks({ resolve, load });
@@ -1229,7 +1266,7 @@ function registerESMLoader() {
1229
1266
  if (!nodeModule.register)
1230
1267
  return;
1231
1268
  const { port1, port2 } = new MessageChannel();
1232
- nodeModule.register(import_url2.default.pathToFileURL(require.resolve("../transform/esmLoader.js")), {
1269
+ nodeModule.register(import_url3.default.pathToFileURL(require.resolve("../transform/esmLoader.js")), {
1233
1270
  data: { port: port2 },
1234
1271
  transferList: [port2]
1235
1272
  });
@@ -1249,7 +1286,7 @@ async function startCollectingFileDeps2() {
1249
1286
  async function stopCollectingFileDeps2(file2) {
1250
1287
  stopCollectingFileDeps(file2);
1251
1288
  if (loaderChannel)
1252
- await loaderChannel.send("stopCollectingFileDeps", { file: file2 });
1289
+ await loaderChannel.send("stopCollectingFileDeps", { file: file2, dependencies: [...dependenciesForTestFile(file2)] });
1253
1290
  }
1254
1291
  async function incorporateCompilationCache() {
1255
1292
  if (!loaderChannel)
@@ -1321,8 +1358,8 @@ async function deserializeConfig(data) {
1321
1358
  }
1322
1359
  async function loadUserConfig(location) {
1323
1360
  let object = location.resolvedConfigFile ? await requireOrImport(location.resolvedConfigFile) : {};
1324
- if (object && typeof object === "object" && "default" in object)
1325
- object = object["default"];
1361
+ if (object && typeof object === "object")
1362
+ object = "default" in object ? object["default"] : { ...object };
1326
1363
  return object;
1327
1364
  }
1328
1365
  async function loadConfig(location, overrides, ignoreProjectDependencies = false, metadata) {
@@ -1337,10 +1374,8 @@ async function loadConfig(location, overrides, ignoreProjectDependencies = false
1337
1374
  project.teardown = void 0;
1338
1375
  }
1339
1376
  }
1340
- const babelPlugins = userConfig["@playwright/test"]?.babelPlugins || [];
1341
1377
  const external = userConfig.build?.external || [];
1342
- const jsxImportSource = import_path7.default.dirname(require.resolve("playwright"));
1343
- await setTransformConfig({ babelPlugins, external, jsxImportSource });
1378
+ await setTransformConfig({ external });
1344
1379
  if (!overrides?.tsconfig)
1345
1380
  await setSingleTSConfig(fullConfig?.singleTSConfigPath);
1346
1381
  return fullConfig;
@@ -1443,8 +1478,8 @@ function validateConfig(file2, config) {
1443
1478
  throw errorWithFile(file2, `config.shard.current must be a positive number, not greater than config.shard.total`);
1444
1479
  }
1445
1480
  if ("updateSnapshots" in config && config.updateSnapshots !== void 0) {
1446
- if (typeof config.updateSnapshots !== "string" || !["all", "changed", "missing", "none"].includes(config.updateSnapshots))
1447
- throw errorWithFile(file2, `config.updateSnapshots must be one of "all", "changed", "missing" or "none"`);
1481
+ if (typeof config.updateSnapshots !== "string" || !["all", "changed", "missing", "none", "default"].includes(config.updateSnapshots))
1482
+ throw errorWithFile(file2, `config.updateSnapshots must be one of "all", "changed", "missing", "none" or "default"`);
1448
1483
  }
1449
1484
  if ("retryStrategy" in config && config.retryStrategy !== void 0) {
1450
1485
  if (typeof config.retryStrategy !== "string" || !["immediate", "isolated"].includes(config.retryStrategy))
@@ -1480,6 +1515,10 @@ function validateProject(file2, project, title) {
1480
1515
  if (typeof project.testDir !== "string")
1481
1516
  throw errorWithFile(file2, `${title}.testDir must be a string`);
1482
1517
  }
1518
+ if (project.expect?.toHaveScreenshot?.type !== void 0) {
1519
+ if (!["png", "webp"].includes(project.expect.toHaveScreenshot.type))
1520
+ throw errorWithFile(file2, `${title}.expect.toHaveScreenshot.type must be one of "png" or "webp"`);
1521
+ }
1483
1522
  for (const prop of ["testIgnore", "testMatch"]) {
1484
1523
  if (prop in project && project[prop] !== void 0) {
1485
1524
  const value = project[prop];
@@ -1545,8 +1584,8 @@ function resolveConfigFile2(configFileOrDirectory) {
1545
1584
  async function loadConfigFromFile(configFile, overrides, ignoreDeps) {
1546
1585
  return await loadConfig(resolveConfigLocation(configFile), overrides, ignoreDeps);
1547
1586
  }
1548
- async function loadEmptyConfigForMergeReports() {
1549
- return await loadConfig({ configDir: process.cwd() });
1587
+ async function loadEmptyConfigForMergeReports(overrides) {
1588
+ return await loadConfig({ configDir: process.cwd() }, overrides);
1550
1589
  }
1551
1590
 
1552
1591
  // packages/playwright/src/common/fixtures.ts
@@ -1945,7 +1984,6 @@ var import_bootstrap = require("playwright-core/lib/bootstrap");
1945
1984
  var import_package4 = require("../package");
1946
1985
  var { ManualPromise } = require("playwright-core/lib/coreBundle").iso;
1947
1986
  var { setTimeOrigin } = require("playwright-core/lib/coreBundle").iso;
1948
- var { startProfiling, stopProfiling } = require("playwright-core/lib/coreBundle").utils;
1949
1987
  var { setBoxedStackPrefixes } = require("playwright-core/lib/coreBundle").utils;
1950
1988
  var ProcessRunner = class {
1951
1989
  async gracefullyClose() {
@@ -1965,7 +2003,6 @@ var ProcessRunner = class {
1965
2003
  var gracefullyCloseCalled = false;
1966
2004
  var forceExitInitiated = false;
1967
2005
  var processRunner;
1968
- var processName;
1969
2006
  var startingEnv = { ...process.env };
1970
2007
  setBoxedStackPrefixes([import_package4.packageRoot]);
1971
2008
  function startProcessRunner(create) {
@@ -1978,10 +2015,8 @@ function startProcessRunner(create) {
1978
2015
  process.on("message", async (message) => {
1979
2016
  if (message.method === "__init__") {
1980
2017
  const { processParams, runnerParams } = message.params;
1981
- void startProfiling();
1982
2018
  setTimeOrigin(processParams.timeOrigin);
1983
2019
  processRunner = create(runnerParams);
1984
- processName = processParams.processName;
1985
2020
  return;
1986
2021
  }
1987
2022
  if (message.method === "__stop__") {
@@ -2007,19 +2042,20 @@ function startProcessRunner(create) {
2007
2042
  });
2008
2043
  }
2009
2044
  var kForceExitTimeout = +(process.env.PWTEST_FORCE_EXIT_TIMEOUT || 3e4);
2045
+ var kHeartbeatInterval = 1e3;
2010
2046
  async function gracefullyCloseAndExit(forceExit) {
2011
2047
  if (forceExit && !forceExitInitiated) {
2012
2048
  forceExitInitiated = true;
2013
- setTimeout(() => process.exit(0), kForceExitTimeout);
2049
+ setTimeout(() => (0, import_bootstrap.processExit)(0), kForceExitTimeout);
2014
2050
  }
2015
2051
  if (!gracefullyCloseCalled) {
2016
2052
  gracefullyCloseCalled = true;
2053
+ const heartbeat = setInterval(() => sendMessageToParent({ method: "__heartbeat__" }), kHeartbeatInterval);
2054
+ heartbeat.unref();
2017
2055
  await processRunner?.gracefullyClose().catch(() => {
2018
2056
  });
2019
- if (processName)
2020
- await stopProfiling(processName).catch(() => {
2021
- });
2022
- process.exit(0);
2057
+ clearInterval(heartbeat);
2058
+ (0, import_bootstrap.processExit)(0);
2023
2059
  }
2024
2060
  }
2025
2061
  function sendMessageToParent(message) {
@@ -2089,6 +2125,10 @@ function bindFileSuiteToProject(project, suite) {
2089
2125
  for (let parentSuite = suite2; parentSuite; parentSuite = parentSuite.parent) {
2090
2126
  if (parentSuite._staticAnnotations.length)
2091
2127
  test.annotations.unshift(...parentSuite._staticAnnotations);
2128
+ if (parentSuite._parallelMode === "serial")
2129
+ test.annotations.unshift({ type: "serial", location: parentSuite.location });
2130
+ if (parentSuite._locks.length)
2131
+ test._locks.push(...parentSuite._locks);
2092
2132
  if (inheritedRetries === void 0 && parentSuite._retries !== void 0)
2093
2133
  inheritedRetries = parentSuite._retries;
2094
2134
  if (inheritedTimeout === void 0 && parentSuite._timeout !== void 0)
@@ -2193,6 +2233,12 @@ var testDetailsSchema = {
2193
2233
  testAnnotationSchema,
2194
2234
  { type: "array", items: testAnnotationSchema }
2195
2235
  ]
2236
+ },
2237
+ lock: {
2238
+ oneOf: [
2239
+ { type: "string" },
2240
+ { type: "array", items: { type: "string" } }
2241
+ ]
2196
2242
  }
2197
2243
  }
2198
2244
  };
@@ -2205,9 +2251,12 @@ function validateTestDetails(details, location) {
2205
2251
  const tags = tag === void 0 ? [] : typeof tag === "string" ? [tag] : tag;
2206
2252
  const annotation = obj.annotation;
2207
2253
  const annotations = annotation === void 0 ? [] : Array.isArray(annotation) ? annotation : [annotation];
2254
+ const lock = obj.lock;
2255
+ const locks = lock === void 0 ? [] : typeof lock === "string" ? [lock] : lock;
2208
2256
  return {
2209
2257
  annotations: annotations.map((a) => ({ ...a, location })),
2210
2258
  tags,
2259
+ locks,
2211
2260
  location
2212
2261
  };
2213
2262
  }
@@ -2291,6 +2340,7 @@ var TestTypeImpl = class _TestTypeImpl {
2291
2340
  test._requireFile = suite._requireFile;
2292
2341
  test.annotations.push(...validatedDetails.annotations);
2293
2342
  test._tags.push(...validatedDetails.tags);
2343
+ test._locks.push(...validatedDetails.locks);
2294
2344
  suite._addTest(test);
2295
2345
  if (type === "only" || type === "fail.only")
2296
2346
  test._only = true;
@@ -2326,6 +2376,7 @@ var TestTypeImpl = class _TestTypeImpl {
2326
2376
  child.location = location;
2327
2377
  child._staticAnnotations.push(...validatedDetails.annotations);
2328
2378
  child._tags.push(...validatedDetails.tags);
2379
+ child._locks.push(...validatedDetails.locks);
2329
2380
  suite._addSuite(child);
2330
2381
  if (type === "only" || type === "serial.only" || type === "parallel.only")
2331
2382
  child._only = true;
@@ -2360,6 +2411,8 @@ var TestTypeImpl = class _TestTypeImpl {
2360
2411
  const suite = this._currentSuite(location, `test.describe.configure()`);
2361
2412
  if (!suite)
2362
2413
  return;
2414
+ if (options.lock !== void 0)
2415
+ suite._locks.push(...validateTestDetails({ lock: options.lock }, location).locks);
2363
2416
  if (options.timeout !== void 0)
2364
2417
  suite._timeout = options.timeout;
2365
2418
  if (options.retries !== void 0)
@@ -2392,7 +2445,7 @@ var TestTypeImpl = class _TestTypeImpl {
2392
2445
  } else {
2393
2446
  if (modifierArgs.length >= 1 && !modifierArgs[0])
2394
2447
  return;
2395
- const description = modifierArgs[1];
2448
+ const description = modifierArgs.length === 1 && typeof modifierArgs[0] === "string" ? modifierArgs[0] : modifierArgs[1];
2396
2449
  suite._staticAnnotations.push({ type, description, location });
2397
2450
  }
2398
2451
  return;
@@ -2432,13 +2485,13 @@ var TestTypeImpl = class _TestTypeImpl {
2432
2485
  if (!testInfo)
2433
2486
  throw new Error(`test.step() can only be called from a test`);
2434
2487
  await testInfo._onUserStepBegin?.(title);
2435
- const step = testInfo._addStep({ category: "test.step", title, location: options.location, box: options.box });
2488
+ const step = testInfo._addStep({ category: "test.step", title, subtitle: options.subtitle, stack: options.location ? [options.location] : void 0, box: options.box, params: options.params });
2436
2489
  return await currentZone().with("stepZone", step).run(async () => {
2437
2490
  try {
2438
2491
  let result2 = void 0;
2439
2492
  result2 = await raceAgainstDeadline(async () => {
2440
2493
  try {
2441
- return await step.info._runStepBody(expectation === "skip", body, step.location);
2494
+ return await step.info._runStepBody(expectation === "skip", body, step.stack[0]);
2442
2495
  } catch (e) {
2443
2496
  if (result2?.timedOut)
2444
2497
  testInfo._failWithError(e);
@@ -2510,6 +2563,7 @@ var baseFullConfig = {
2510
2563
  metadata: {},
2511
2564
  preserveOutput: "always",
2512
2565
  projects: [],
2566
+ filteredProjects: [],
2513
2567
  reporter: [[process.env.CI ? "dot" : "list"]],
2514
2568
  reportSlowTests: {
2515
2569
  max: 5,
@@ -2521,7 +2575,7 @@ var baseFullConfig = {
2521
2575
  quiet: false,
2522
2576
  shard: null,
2523
2577
  tags: [],
2524
- updateSnapshots: "missing",
2578
+ updateSnapshots: "default",
2525
2579
  updateSourceMethod: "patch",
2526
2580
  version: "",
2527
2581
  workers: 0,
@@ -2573,6 +2627,7 @@ var Suite = class _Suite extends Base {
2573
2627
  this._staticAnnotations = [];
2574
2628
  // Explicitly declared tags that are not a part of the title.
2575
2629
  this._tags = [];
2630
+ this._locks = [];
2576
2631
  this._modifiers = [];
2577
2632
  this._parallelMode = "none";
2578
2633
  this._type = type;
@@ -2715,6 +2770,7 @@ var Suite = class _Suite extends Base {
2715
2770
  retries: this._retries,
2716
2771
  staticAnnotations: this._staticAnnotations.slice(),
2717
2772
  tags: this._tags.slice(),
2773
+ locks: this._locks.slice(),
2718
2774
  modifiers: this._modifiers.slice(),
2719
2775
  parallelMode: this._parallelMode,
2720
2776
  hooks: this._hooks.map((h) => ({ type: h.type, location: h.location, title: h.title })),
@@ -2730,6 +2786,7 @@ var Suite = class _Suite extends Base {
2730
2786
  suite._retries = data.retries;
2731
2787
  suite._staticAnnotations = data.staticAnnotations;
2732
2788
  suite._tags = data.tags;
2789
+ suite._locks = data.locks;
2733
2790
  suite._modifiers = data.modifiers;
2734
2791
  suite._parallelMode = data.parallelMode;
2735
2792
  suite._hooks = data.hooks.map((h) => ({ type: h.type, location: h.location, title: h.title, fn: () => {
@@ -2765,6 +2822,7 @@ var TestCase = class _TestCase extends Base {
2765
2822
  this._projectId = "";
2766
2823
  // Explicitly declared tags that are not a part of the title.
2767
2824
  this._tags = [];
2825
+ this._locks = [];
2768
2826
  this._planAnnotations = [];
2769
2827
  this.fn = fn;
2770
2828
  this._testType = testType;
@@ -2815,6 +2873,7 @@ var TestCase = class _TestCase extends Base {
2815
2873
  workerHash: this._workerHash,
2816
2874
  annotations: this.annotations.slice(),
2817
2875
  tags: this._tags.slice(),
2876
+ locks: this._locks.slice(),
2818
2877
  projectId: this._projectId
2819
2878
  };
2820
2879
  }
@@ -2831,6 +2890,7 @@ var TestCase = class _TestCase extends Base {
2831
2890
  test._workerHash = data.workerHash;
2832
2891
  test.annotations = data.annotations;
2833
2892
  test._tags = data.tags;
2893
+ test._locks = data.locks;
2834
2894
  test._projectId = data.projectId;
2835
2895
  return test;
2836
2896
  }
@@ -2879,7 +2939,6 @@ __export(testLoader_exports, {
2879
2939
  loadTestFile: () => loadTestFile
2880
2940
  });
2881
2941
  var import_path9 = __toESM(require("path"));
2882
- var import_util11 = __toESM(require("util"));
2883
2942
  var import_globals3 = require("../globals");
2884
2943
  var defaultTimeout2 = 3e4;
2885
2944
  var cachedFileSuites = /* @__PURE__ */ new Map();
@@ -2891,15 +2950,16 @@ async function loadTestFile(file2, config, testErrors) {
2891
2950
  suite.location = { file: file2, line: 0, column: 0 };
2892
2951
  suite._tags = [...config.config.tags];
2893
2952
  (0, import_globals3.setCurrentlyLoadingFileSuite)(suite);
2894
- if (!(0, import_globals3.isWorkerProcess)())
2895
- await startCollectingFileDeps2();
2896
2953
  try {
2954
+ installTransformIfNeeded();
2955
+ if (!(0, import_globals3.isWorkerProcess)())
2956
+ await startCollectingFileDeps2();
2897
2957
  await requireOrImport(file2);
2898
2958
  cachedFileSuites.set(file2, suite);
2899
2959
  } catch (e) {
2900
2960
  if (!testErrors)
2901
2961
  throw e;
2902
- testErrors.push(serializeLoadError(file2, e));
2962
+ testErrors.push(...serializeLoadErrors(e));
2903
2963
  } finally {
2904
2964
  (0, import_globals3.setCurrentlyLoadingFileSuite)(void 0);
2905
2965
  if (!(0, import_globals3.isWorkerProcess)())
@@ -2918,18 +2978,17 @@ async function loadTestFile(file2, config, testErrors) {
2918
2978
  }
2919
2979
  return suite;
2920
2980
  }
2921
- function serializeLoadError(file2, error) {
2922
- if (error instanceof Error) {
2923
- const result2 = filterStackTrace(error);
2924
- const loc = error.loc;
2925
- result2.location = loc ? {
2926
- file: file2,
2927
- line: loc.line || 0,
2928
- column: loc.column || 0
2929
- } : void 0;
2930
- return result2;
2931
- }
2932
- return { value: import_util11.default.inspect(error) };
2981
+ function serializeLoadErrors(error) {
2982
+ if (error instanceof AggregateError)
2983
+ return error.errors.flatMap(serializeLoadErrors);
2984
+ const result2 = serializeError(error);
2985
+ if (error instanceof Error)
2986
+ result2.location = parseErrorLocation(error);
2987
+ return [result2];
2988
+ }
2989
+ function parseErrorLocation(error) {
2990
+ const location = error.loc ?? error.position;
2991
+ return location && { file: location.file, line: location.line, column: location.column };
2933
2992
  }
2934
2993
  // Annotate the CommonJS export names for ESM import in node:
2935
2994
  0 && (module.exports = {