@smoothdeploy/playwright 1.60.1 → 1.62.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.
- package/lib/agents/copilot-setup-steps.yml +2 -2
- package/lib/agents/generateAgents.js +48 -0
- package/lib/cli/reportActions.js +2 -2
- package/lib/cli/testActions.js +2 -0
- package/lib/common/index.js +246 -187
- package/lib/common/index.js.txt +13 -14
- package/lib/errorContext.js +2 -3
- package/lib/index.js +48 -21
- package/lib/loader/loaderProcessEntry.js +1 -1
- package/lib/matchers/expect.js +4830 -4394
- package/lib/matchers/expect.js.LICENSE +87 -140
- package/lib/matchers/expect.js.txt +30 -35
- package/lib/mcp/test/testContext.js +5 -1
- package/lib/program.js +28 -3
- package/lib/runner/index.js +400 -194
- package/lib/runner/index.js.txt +19 -18
- package/lib/transform/babelBundle.js +12899 -11654
- package/lib/transform/babelBundle.js.LICENSE +379 -354
- package/lib/transform/babelBundle.js.txt +39 -39
- package/lib/transform/esmLoader.js +3275 -1154
- package/lib/transform/esmLoader.js.LICENSE +81 -61
- package/lib/transform/esmLoader.js.txt +23 -18
- package/lib/util.js +14 -44
- package/lib/worker/workerProcessEntry.js +60 -1461
- package/lib/worker/workerProcessEntry.js.txt +8 -13
- package/package.json +3 -6
- package/types/test.d.ts +458 -21
- package/types/testReporter.d.ts +79 -4
package/lib/common/index.js
CHANGED
|
@@ -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,
|
|
@@ -79,7 +78,6 @@ var import_globals = require("../globals");
|
|
|
79
78
|
var import_package = require("../package");
|
|
80
79
|
var sourceMapSupport = require("playwright-core/lib/utilsBundle").sourceMapSupport;
|
|
81
80
|
var { calculateSha1 } = require("playwright-core/lib/coreBundle").utils;
|
|
82
|
-
var { isUnderTest } = require("playwright-core/lib/coreBundle").utils;
|
|
83
81
|
var cacheDir = process.env.PWTEST_CACHE_DIR || (() => {
|
|
84
82
|
if (process.platform === "win32")
|
|
85
83
|
return import_path.default.join(import_os.default.tmpdir(), `playwright-transform-cache`);
|
|
@@ -89,15 +87,12 @@ var sourceMaps = /* @__PURE__ */ new Map();
|
|
|
89
87
|
var memoryCache = /* @__PURE__ */ new Map();
|
|
90
88
|
var fileDependencies = /* @__PURE__ */ new Map();
|
|
91
89
|
var externalDependencies = /* @__PURE__ */ new Map();
|
|
92
|
-
var devSourceInfix = import_path.default.sep + "playwright" + import_path.default.sep + "packages" + import_path.default.sep;
|
|
93
90
|
function installSourceMapSupport() {
|
|
94
91
|
Error.stackTraceLimit = 200;
|
|
95
92
|
sourceMapSupport.install({
|
|
96
93
|
environment: "node",
|
|
97
94
|
handleUncaughtExceptions: false,
|
|
98
95
|
retrieveSourceMap(source) {
|
|
99
|
-
if (!process.env.PWDEBUGIMPL && isUnderTest() && source.includes(devSourceInfix))
|
|
100
|
-
return { map: identitySourceMap(source), url: source };
|
|
101
96
|
if (!sourceMaps.has(source))
|
|
102
97
|
return null;
|
|
103
98
|
const sourceMapPath = sourceMaps.get(source);
|
|
@@ -112,14 +107,6 @@ function installSourceMapSupport() {
|
|
|
112
107
|
}
|
|
113
108
|
});
|
|
114
109
|
}
|
|
115
|
-
function identitySourceMap(source) {
|
|
116
|
-
const lineCount = import_fs.default.readFileSync(source, "utf8").split("\n").length;
|
|
117
|
-
return {
|
|
118
|
-
version: 3,
|
|
119
|
-
sources: [source],
|
|
120
|
-
mappings: lineCount ? "AAAA" + ";AACA".repeat(lineCount - 1) : ""
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
110
|
function _innerAddToCompilationCacheAndSerialize(filename, entry) {
|
|
124
111
|
sourceMaps.set(entry.moduleUrl || filename, entry.sourceMapPath);
|
|
125
112
|
memoryCache.set(filename, entry);
|
|
@@ -130,11 +117,29 @@ function _innerAddToCompilationCacheAndSerialize(filename, entry) {
|
|
|
130
117
|
externalDependencies: []
|
|
131
118
|
};
|
|
132
119
|
}
|
|
120
|
+
function writeCodeCache(codePath, code) {
|
|
121
|
+
import_fs.default.writeFileSync(codePath, `// ${calculateSha1(code)}
|
|
122
|
+
${code}`, "utf8");
|
|
123
|
+
}
|
|
124
|
+
function readCodeCache(codePath) {
|
|
125
|
+
const content = import_fs.default.readFileSync(codePath, "utf8");
|
|
126
|
+
const newLineIndex = content.indexOf("\n");
|
|
127
|
+
if (newLineIndex === -1)
|
|
128
|
+
throw new Error(`Cache file is missing the hash header`);
|
|
129
|
+
const firstLine = content.substring(0, newLineIndex);
|
|
130
|
+
const sha1Length = 40;
|
|
131
|
+
if (firstLine.length !== "// ".length + sha1Length || !firstLine.startsWith("// "))
|
|
132
|
+
throw new Error(`Cache file has a malformed hash header`);
|
|
133
|
+
const code = content.substring(newLineIndex + 1);
|
|
134
|
+
if (calculateSha1(code) !== firstLine.substring("// ".length))
|
|
135
|
+
throw new Error(`Cache file content does not match the hash header`);
|
|
136
|
+
return code;
|
|
137
|
+
}
|
|
133
138
|
function getFromCompilationCache(filename, contentHash, moduleUrl) {
|
|
134
139
|
const cache = memoryCache.get(filename);
|
|
135
140
|
if (cache?.codePath) {
|
|
136
141
|
try {
|
|
137
|
-
return { cachedCode:
|
|
142
|
+
return { cachedCode: readCodeCache(cache.codePath) };
|
|
138
143
|
} catch {
|
|
139
144
|
}
|
|
140
145
|
}
|
|
@@ -146,7 +151,7 @@ function getFromCompilationCache(filename, contentHash, moduleUrl) {
|
|
|
146
151
|
const sourceMapPath = cachePath + ".map";
|
|
147
152
|
const dataPath = cachePath + ".data";
|
|
148
153
|
try {
|
|
149
|
-
const cachedCode =
|
|
154
|
+
const cachedCode = readCodeCache(codePath);
|
|
150
155
|
const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, dataPath, moduleUrl });
|
|
151
156
|
return { cachedCode, serializedCache };
|
|
152
157
|
} catch {
|
|
@@ -161,7 +166,7 @@ function getFromCompilationCache(filename, contentHash, moduleUrl) {
|
|
|
161
166
|
import_fs.default.writeFileSync(sourceMapPath, JSON.stringify(map), "utf8");
|
|
162
167
|
if (data.size)
|
|
163
168
|
import_fs.default.writeFileSync(dataPath, JSON.stringify(Object.fromEntries(data.entries()), void 0, 2), "utf8");
|
|
164
|
-
|
|
169
|
+
writeCodeCache(codePath, code);
|
|
165
170
|
const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, dataPath, moduleUrl });
|
|
166
171
|
return { serializedCache };
|
|
167
172
|
}
|
|
@@ -311,18 +316,15 @@ var import_package2 = require("../package");
|
|
|
311
316
|
// packages/playwright/src/util.ts
|
|
312
317
|
var import_fs2 = __toESM(require("fs"));
|
|
313
318
|
var import_path2 = __toESM(require("path"));
|
|
314
|
-
var import_url = __toESM(require("url"));
|
|
315
319
|
var import_util = __toESM(require("util"));
|
|
316
320
|
var debug = require("playwright-core/lib/utilsBundle").debug;
|
|
317
321
|
var mime = require("playwright-core/lib/utilsBundle").mime;
|
|
318
|
-
var minimatch = require("playwright-core/lib/utilsBundle")
|
|
322
|
+
var { minimatch } = require("playwright-core/lib/utilsBundle");
|
|
319
323
|
var { calculateSha1: calculateSha12 } = require("playwright-core/lib/coreBundle").utils;
|
|
320
324
|
var { sanitizeForFilePath } = require("playwright-core/lib/coreBundle").utils;
|
|
321
325
|
var { isRegExp } = require("playwright-core/lib/coreBundle").iso;
|
|
322
|
-
var {
|
|
326
|
+
var { stringifyStackFrames, filteredStackTrace } = require("playwright-core/lib/coreBundle").utils;
|
|
323
327
|
var { ansiRegex, isString, stripAnsiEscapes } = require("playwright-core/lib/coreBundle").iso;
|
|
324
|
-
var PLAYWRIGHT_TEST_PATH = import_path2.default.join(__dirname, "..");
|
|
325
|
-
var PLAYWRIGHT_CORE_PATH = import_path2.default.dirname(require.resolve("playwright-core/package.json"));
|
|
326
328
|
function filterStackTrace(e) {
|
|
327
329
|
const name = e.name ? e.name + ": " : "";
|
|
328
330
|
const cause = e.cause instanceof Error ? filterStackTrace(e.cause) : void 0;
|
|
@@ -335,27 +337,6 @@ function filterStackTrace(e) {
|
|
|
335
337
|
cause
|
|
336
338
|
};
|
|
337
339
|
}
|
|
338
|
-
function filterStackFile(file2) {
|
|
339
|
-
if (process.env.PWDEBUGIMPL)
|
|
340
|
-
return true;
|
|
341
|
-
if (file2.startsWith(PLAYWRIGHT_TEST_PATH))
|
|
342
|
-
return false;
|
|
343
|
-
if (file2.startsWith(PLAYWRIGHT_CORE_PATH))
|
|
344
|
-
return false;
|
|
345
|
-
return true;
|
|
346
|
-
}
|
|
347
|
-
function filteredStackTrace(rawStack) {
|
|
348
|
-
const frames = [];
|
|
349
|
-
for (const line of rawStack) {
|
|
350
|
-
const frame = parseStackFrame(line, import_path2.default.sep, !!process.env.PWDEBUGIMPL);
|
|
351
|
-
if (!frame || !frame.file)
|
|
352
|
-
continue;
|
|
353
|
-
if (!filterStackFile(frame.file))
|
|
354
|
-
continue;
|
|
355
|
-
frames.push(frame);
|
|
356
|
-
}
|
|
357
|
-
return frames;
|
|
358
|
-
}
|
|
359
340
|
function serializeError(error) {
|
|
360
341
|
if (error instanceof Error)
|
|
361
342
|
return filterStackTrace(error);
|
|
@@ -391,10 +372,10 @@ function createFileMatcher(patterns) {
|
|
|
391
372
|
return true;
|
|
392
373
|
}
|
|
393
374
|
if (import_path2.default.sep === "\\") {
|
|
394
|
-
const
|
|
375
|
+
const unixPath = filePath.split(import_path2.default.sep).join("/");
|
|
395
376
|
for (const re of reList) {
|
|
396
377
|
re.lastIndex = 0;
|
|
397
|
-
if (re.test(
|
|
378
|
+
if (re.test(unixPath))
|
|
398
379
|
return true;
|
|
399
380
|
}
|
|
400
381
|
}
|
|
@@ -460,11 +441,20 @@ function fileIsModule(file2) {
|
|
|
460
441
|
const folder = import_path2.default.dirname(file2);
|
|
461
442
|
return folderIsModule(folder);
|
|
462
443
|
}
|
|
444
|
+
var packageJsonIsModuleCache = /* @__PURE__ */ new Map();
|
|
463
445
|
function folderIsModule(folder) {
|
|
464
446
|
const packageJsonPath = getPackageJsonPath(folder);
|
|
465
447
|
if (!packageJsonPath)
|
|
466
448
|
return false;
|
|
467
|
-
|
|
449
|
+
if (!packageJsonIsModuleCache.has(packageJsonPath)) {
|
|
450
|
+
let isModule2 = false;
|
|
451
|
+
try {
|
|
452
|
+
isModule2 = JSON.parse(import_fs2.default.readFileSync(packageJsonPath, "utf8")).type === "module";
|
|
453
|
+
} catch {
|
|
454
|
+
}
|
|
455
|
+
packageJsonIsModuleCache.set(packageJsonPath, isModule2);
|
|
456
|
+
}
|
|
457
|
+
return packageJsonIsModuleCache.get(packageJsonPath);
|
|
468
458
|
}
|
|
469
459
|
var packageJsonMainFieldCache = /* @__PURE__ */ new Map();
|
|
470
460
|
function getMainFieldFromPackageJson(packageJsonPath) {
|
|
@@ -549,7 +539,7 @@ var FullConfigInternal = class {
|
|
|
549
539
|
this.plugins = (privateConfiguration?.plugins || []).map((p) => ({ factory: p }));
|
|
550
540
|
this.singleTSConfigPath = pathResolve(configDir, userConfig.tsconfig);
|
|
551
541
|
this.captureGitInfo = userConfig.captureGitInfo;
|
|
552
|
-
this.
|
|
542
|
+
this.retryStrategy = takeFirst(userConfig.retryStrategy, "immediate");
|
|
553
543
|
this.globalSetups = (Array.isArray(userConfig.globalSetup) ? userConfig.globalSetup : [userConfig.globalSetup]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
|
|
554
544
|
this.globalTeardowns = (Array.isArray(userConfig.globalTeardown) ? userConfig.globalTeardown : [userConfig.globalTeardown]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
|
|
555
545
|
userConfig.metadata = userConfig.metadata || {};
|
|
@@ -559,8 +549,10 @@ var FullConfigInternal = class {
|
|
|
559
549
|
throw new Error(`Tag must start with "@" symbol, got "${tag}" instead.`);
|
|
560
550
|
}
|
|
561
551
|
this.config = {
|
|
552
|
+
argv: configCLIOverrides.argv ?? [],
|
|
562
553
|
configFile: resolvedConfigFile,
|
|
563
554
|
rootDir: pathResolve(configDir, userConfig.testDir) || configDir,
|
|
555
|
+
failOnFlakyTests: takeFirst(configCLIOverrides.failOnFlakyTests, userConfig.failOnFlakyTests, false),
|
|
564
556
|
forbidOnly: takeFirst(configCLIOverrides.forbidOnly, userConfig.forbidOnly, false),
|
|
565
557
|
fullyParallel: takeFirst(configCLIOverrides.fullyParallel, userConfig.fullyParallel, false),
|
|
566
558
|
globalSetup: this.globalSetups[0] ?? null,
|
|
@@ -678,8 +670,13 @@ function resolveReporters(reporters, rootDir) {
|
|
|
678
670
|
function resolveWorkers(workers) {
|
|
679
671
|
if (typeof workers === "string") {
|
|
680
672
|
if (workers.endsWith("%")) {
|
|
673
|
+
const percent = parseInt(workers, 10);
|
|
674
|
+
if (isNaN(percent))
|
|
675
|
+
throw new Error(`Workers ${workers} must be a number or percentage.`);
|
|
676
|
+
if (percent < 1)
|
|
677
|
+
throw new Error(`Workers must be a positive number, received ${percent}.`);
|
|
681
678
|
const cpus = import_os2.default.cpus().length;
|
|
682
|
-
return Math.max(1, Math.floor(cpus * (
|
|
679
|
+
return Math.max(1, Math.floor(cpus * (percent / 100)));
|
|
683
680
|
}
|
|
684
681
|
const parsedWorkers = parseInt(workers, 10);
|
|
685
682
|
if (isNaN(parsedWorkers))
|
|
@@ -743,7 +740,7 @@ function resolveScript(id, rootDir) {
|
|
|
743
740
|
}
|
|
744
741
|
var defaultGrep = /.*/;
|
|
745
742
|
var defaultReporter = process.env.CI ? "dot" : "list";
|
|
746
|
-
var configInternalSymbol = Symbol("configInternalSymbol");
|
|
743
|
+
var configInternalSymbol = /* @__PURE__ */ Symbol("configInternalSymbol");
|
|
747
744
|
function getProjectId(project) {
|
|
748
745
|
return project.__projectId;
|
|
749
746
|
}
|
|
@@ -758,24 +755,25 @@ __export(configLoader_exports, {
|
|
|
758
755
|
loadEmptyConfigForMergeReports: () => loadEmptyConfigForMergeReports,
|
|
759
756
|
resolveConfigLocation: () => resolveConfigLocation
|
|
760
757
|
});
|
|
761
|
-
var
|
|
758
|
+
var import_fs7 = __toESM(require("fs"));
|
|
762
759
|
var import_path7 = __toESM(require("path"));
|
|
763
760
|
|
|
764
761
|
// packages/playwright/src/transform/transform.ts
|
|
765
762
|
var transform_exports = {};
|
|
766
763
|
__export(transform_exports, {
|
|
764
|
+
incorporateCompilationCache: () => incorporateCompilationCache,
|
|
767
765
|
requireOrImport: () => requireOrImport,
|
|
768
766
|
resolveHook: () => resolveHook,
|
|
769
767
|
setSingleTSConfig: () => setSingleTSConfig,
|
|
770
768
|
setTransformConfig: () => setTransformConfig,
|
|
771
769
|
setTransformData: () => setTransformData,
|
|
772
770
|
shouldTransform: () => shouldTransform,
|
|
773
|
-
|
|
774
|
-
|
|
771
|
+
startCollectingFileDeps: () => startCollectingFileDeps2,
|
|
772
|
+
stopCollectingFileDeps: () => stopCollectingFileDeps2,
|
|
775
773
|
transformHook: () => transformHook,
|
|
776
774
|
wrapFunctionWithLocation: () => wrapFunctionWithLocation
|
|
777
775
|
});
|
|
778
|
-
var
|
|
776
|
+
var import_fs6 = __toESM(require("fs"));
|
|
779
777
|
var import_module2 = __toESM(require("module"));
|
|
780
778
|
var import_path6 = __toESM(require("path"));
|
|
781
779
|
var import_url2 = __toESM(require("url"));
|
|
@@ -795,13 +793,16 @@ function loadTsConfig(configPath) {
|
|
|
795
793
|
${e.message}`);
|
|
796
794
|
}
|
|
797
795
|
}
|
|
798
|
-
function resolveConfigFile(baseConfigFile, referencedConfigFile) {
|
|
796
|
+
function resolveConfigFile(baseConfigFile, referencedConfigFile, kind) {
|
|
797
|
+
const originalReferencedConfigFile = referencedConfigFile;
|
|
799
798
|
if (!referencedConfigFile.endsWith(".json"))
|
|
800
799
|
referencedConfigFile += ".json";
|
|
801
800
|
const currentDir = import_path4.default.dirname(baseConfigFile);
|
|
802
801
|
let resolvedConfigFile = import_path4.default.resolve(currentDir, referencedConfigFile);
|
|
803
802
|
if (referencedConfigFile.includes("/") && referencedConfigFile.includes(".") && !import_fs4.default.existsSync(resolvedConfigFile))
|
|
804
803
|
resolvedConfigFile = import_path4.default.join(currentDir, "node_modules", referencedConfigFile);
|
|
804
|
+
if (!import_fs4.default.existsSync(resolvedConfigFile))
|
|
805
|
+
throw new Error(`Failed to resolve "${kind}" path "${originalReferencedConfigFile}" referenced from ${baseConfigFile}`);
|
|
805
806
|
return resolvedConfigFile;
|
|
806
807
|
}
|
|
807
808
|
function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */ new Map()) {
|
|
@@ -818,7 +819,7 @@ function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */
|
|
|
818
819
|
const parsedConfig = json5.parse(cleanedJson);
|
|
819
820
|
const extendsArray = Array.isArray(parsedConfig.extends) ? parsedConfig.extends : parsedConfig.extends ? [parsedConfig.extends] : [];
|
|
820
821
|
for (const extendedConfig of extendsArray) {
|
|
821
|
-
const extendedConfigPath = resolveConfigFile(configFilePath, extendedConfig);
|
|
822
|
+
const extendedConfigPath = resolveConfigFile(configFilePath, extendedConfig, "extends");
|
|
822
823
|
const base = innerLoadTsConfig(extendedConfigPath, references, visited);
|
|
823
824
|
Object.assign(result2, base, { tsConfigPath: configFilePath });
|
|
824
825
|
}
|
|
@@ -834,7 +835,7 @@ function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */
|
|
|
834
835
|
result2.absoluteBaseUrl = import_path4.default.resolve(import_path4.default.dirname(configFilePath), parsedConfig.compilerOptions.baseUrl);
|
|
835
836
|
}
|
|
836
837
|
for (const ref of parsedConfig.references || [])
|
|
837
|
-
references.push(innerLoadTsConfig(resolveConfigFile(configFilePath, ref.path), references, visited));
|
|
838
|
+
references.push(innerLoadTsConfig(resolveConfigFile(configFilePath, ref.path, "references"), references, visited));
|
|
838
839
|
if (import_path4.default.basename(configFilePath) === "jsconfig.json" && result2.allowJs === void 0)
|
|
839
840
|
result2.allowJs = true;
|
|
840
841
|
return result2;
|
|
@@ -852,6 +853,50 @@ function StripBom(string) {
|
|
|
852
853
|
// packages/playwright/src/transform/transform.ts
|
|
853
854
|
var import_package3 = require("../package");
|
|
854
855
|
|
|
856
|
+
// packages/playwright/src/transform/esmLoaderSync.ts
|
|
857
|
+
var import_fs5 = __toESM(require("fs"));
|
|
858
|
+
var import_url = __toESM(require("url"));
|
|
859
|
+
function resolve(specifier, context, nextResolve) {
|
|
860
|
+
if (context.parentURL && context.parentURL.startsWith("file://")) {
|
|
861
|
+
const filename = import_url.default.fileURLToPath(context.parentURL);
|
|
862
|
+
const resolved = resolveHook(filename, specifier);
|
|
863
|
+
if (resolved !== void 0) {
|
|
864
|
+
specifier = new Set(context.conditions).has("import") ? import_url.default.pathToFileURL(resolved).toString() : resolved;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
const result2 = nextResolve(specifier, context);
|
|
868
|
+
if (result2?.url && result2.url.startsWith("file://"))
|
|
869
|
+
currentFileDepsCollector()?.add(import_url.default.fileURLToPath(result2.url));
|
|
870
|
+
return result2;
|
|
871
|
+
}
|
|
872
|
+
var kSupportedFormats = /* @__PURE__ */ new Map([
|
|
873
|
+
["commonjs", "commonjs"],
|
|
874
|
+
["module", "module"],
|
|
875
|
+
["commonjs-typescript", "commonjs"],
|
|
876
|
+
["module-typescript", "module"],
|
|
877
|
+
["typescript", null],
|
|
878
|
+
[null, null],
|
|
879
|
+
[void 0, void 0]
|
|
880
|
+
]);
|
|
881
|
+
function load(moduleUrl, context, nextLoad) {
|
|
882
|
+
if (!kSupportedFormats.has(context.format))
|
|
883
|
+
return nextLoad(moduleUrl, context);
|
|
884
|
+
if (!moduleUrl.startsWith("file://"))
|
|
885
|
+
return nextLoad(moduleUrl, context);
|
|
886
|
+
const filename = import_url.default.fileURLToPath(moduleUrl);
|
|
887
|
+
if (!shouldTransform(filename))
|
|
888
|
+
return nextLoad(moduleUrl, context);
|
|
889
|
+
const isRequire = !new Set(context.conditions).has("import");
|
|
890
|
+
const format = isRequire ? "commonjs" : kSupportedFormats.get(context.format) || (fileIsModule(filename) ? "module" : "commonjs");
|
|
891
|
+
const code = import_fs5.default.readFileSync(filename, "utf-8");
|
|
892
|
+
const transformed = transformHook(code, filename, format === "module" ? moduleUrl : void 0);
|
|
893
|
+
return {
|
|
894
|
+
format,
|
|
895
|
+
source: transformed.code,
|
|
896
|
+
shortCircuit: true
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
|
|
855
900
|
// packages/playwright/src/transform/pirates.ts
|
|
856
901
|
var import_module = __toESM(require("module"));
|
|
857
902
|
var import_path5 = __toESM(require("path"));
|
|
@@ -879,6 +924,48 @@ function addHook(transformHook2, shouldTransform2, extensions) {
|
|
|
879
924
|
}
|
|
880
925
|
}
|
|
881
926
|
|
|
927
|
+
// packages/playwright/src/transform/portTransport.ts
|
|
928
|
+
var PortTransport = class {
|
|
929
|
+
constructor(port, handler) {
|
|
930
|
+
this._lastId = 0;
|
|
931
|
+
this._callbacks = /* @__PURE__ */ new Map();
|
|
932
|
+
this._port = port;
|
|
933
|
+
port.addEventListener("message", async (event) => {
|
|
934
|
+
const message = event.data;
|
|
935
|
+
const { id, ackId, method, params, result: result2 } = message;
|
|
936
|
+
if (ackId) {
|
|
937
|
+
const callback = this._callbacks.get(ackId);
|
|
938
|
+
this._callbacks.delete(ackId);
|
|
939
|
+
this._resetRef();
|
|
940
|
+
callback?.(result2);
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
const handlerResult = await handler(method, params);
|
|
944
|
+
if (id)
|
|
945
|
+
this._port.postMessage({ ackId: id, result: handlerResult });
|
|
946
|
+
});
|
|
947
|
+
this._resetRef();
|
|
948
|
+
}
|
|
949
|
+
post(method, params) {
|
|
950
|
+
this._port.postMessage({ method, params });
|
|
951
|
+
}
|
|
952
|
+
async send(method, params) {
|
|
953
|
+
return await new Promise((f) => {
|
|
954
|
+
const id = ++this._lastId;
|
|
955
|
+
this._callbacks.set(id, f);
|
|
956
|
+
this._resetRef();
|
|
957
|
+
this._port.postMessage({ id, method, params });
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
_resetRef() {
|
|
961
|
+
if (this._callbacks.size) {
|
|
962
|
+
this._port.ref();
|
|
963
|
+
} else {
|
|
964
|
+
this._port.unref();
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
|
|
882
969
|
// packages/playwright/src/transform/transform.ts
|
|
883
970
|
var sourceMapSupport2 = require("playwright-core/lib/utilsBundle").sourceMapSupport;
|
|
884
971
|
var version = import_package3.packageJSON.version;
|
|
@@ -888,20 +975,18 @@ var _transformConfig = {
|
|
|
888
975
|
external: []
|
|
889
976
|
};
|
|
890
977
|
var _externalMatcher = () => false;
|
|
891
|
-
function setTransformConfig(config) {
|
|
978
|
+
async function setTransformConfig(config) {
|
|
892
979
|
_transformConfig = config;
|
|
893
980
|
_externalMatcher = createFileMatcher(_transformConfig.external);
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
return _transformConfig;
|
|
981
|
+
if (loaderChannel)
|
|
982
|
+
await loaderChannel.send("setTransformConfig", { config });
|
|
897
983
|
}
|
|
898
984
|
var _singleTSConfigPath;
|
|
899
985
|
var _singleTSConfig;
|
|
900
|
-
function setSingleTSConfig(value) {
|
|
986
|
+
async function setSingleTSConfig(value) {
|
|
901
987
|
_singleTSConfigPath = value;
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
return _singleTSConfigPath;
|
|
988
|
+
if (loaderChannel)
|
|
989
|
+
await loaderChannel.send("setSingleTSConfig", { tsconfig: value });
|
|
905
990
|
}
|
|
906
991
|
function validateTsConfig(tsconfig) {
|
|
907
992
|
const pathsBase = tsconfig.absoluteBaseUrl ?? tsconfig.paths?.pathsBasePath;
|
|
@@ -932,7 +1017,7 @@ function loadAndValidateTsconfigsForFolder(folder) {
|
|
|
932
1017
|
foldersWithConfig.push(currentFolder);
|
|
933
1018
|
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
934
1019
|
const configPath = import_path6.default.join(currentFolder, name);
|
|
935
|
-
if (
|
|
1020
|
+
if (import_fs6.default.existsSync(configPath)) {
|
|
936
1021
|
const loaded = loadTsConfig(configPath);
|
|
937
1022
|
result2 = loaded.map(validateTsConfig);
|
|
938
1023
|
break;
|
|
@@ -1048,15 +1133,21 @@ async function requireOrImport(file) {
|
|
|
1048
1133
|
if (isModule) {
|
|
1049
1134
|
const fileName = import_url2.default.pathToFileURL(file);
|
|
1050
1135
|
const esmImport = () => eval(`import(${JSON.stringify(fileName)})`);
|
|
1051
|
-
|
|
1136
|
+
if (loaderChannel) {
|
|
1137
|
+
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);
|
|
1138
|
+
}
|
|
1052
1139
|
return await esmImport().finally(nextTask);
|
|
1053
1140
|
}
|
|
1054
1141
|
const result = require(file);
|
|
1055
1142
|
const depsCollector = currentFileDepsCollector();
|
|
1056
1143
|
if (depsCollector) {
|
|
1057
1144
|
const module2 = require.cache[file];
|
|
1058
|
-
if (module2)
|
|
1059
|
-
|
|
1145
|
+
if (module2) {
|
|
1146
|
+
const cjsDeps = /* @__PURE__ */ new Set();
|
|
1147
|
+
collectCJSDependencies(module2, cjsDeps);
|
|
1148
|
+
for (const dep of cjsDeps)
|
|
1149
|
+
depsCollector.add(dep);
|
|
1150
|
+
}
|
|
1060
1151
|
}
|
|
1061
1152
|
return result;
|
|
1062
1153
|
}
|
|
@@ -1065,7 +1156,17 @@ function installTransformIfNeeded() {
|
|
|
1065
1156
|
if (transformInstalled)
|
|
1066
1157
|
return;
|
|
1067
1158
|
transformInstalled = true;
|
|
1159
|
+
registerESMLoader();
|
|
1068
1160
|
installSourceMapSupport();
|
|
1161
|
+
if (loaderChannel) {
|
|
1162
|
+
installCJSHooks();
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1165
|
+
const extensions = import_module2.default._extensions;
|
|
1166
|
+
for (const ext of [".ts", ".cts", ".tsx", ".jsx"])
|
|
1167
|
+
extensions[ext] = extensions[".js"];
|
|
1168
|
+
}
|
|
1169
|
+
function installCJSHooks() {
|
|
1069
1170
|
const originalResolveFilename = import_module2.default._resolveFilename;
|
|
1070
1171
|
function resolveFilename(specifier, parent, ...rest) {
|
|
1071
1172
|
if (parent) {
|
|
@@ -1115,98 +1216,43 @@ function isRelativeSpecifier(specifier) {
|
|
|
1115
1216
|
return specifier === "." || specifier === ".." || specifier.startsWith("./") || specifier.startsWith("../");
|
|
1116
1217
|
}
|
|
1117
1218
|
async function nextTask() {
|
|
1118
|
-
return new Promise((
|
|
1219
|
+
return new Promise((resolve2) => setTimeout(resolve2, 0));
|
|
1119
1220
|
}
|
|
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
1221
|
var loaderChannel;
|
|
1177
1222
|
function registerESMLoader() {
|
|
1178
1223
|
if (process.env.PW_DISABLE_TS_ESM)
|
|
1179
|
-
return
|
|
1224
|
+
return;
|
|
1180
1225
|
if ("Bun" in globalThis)
|
|
1181
|
-
return
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1226
|
+
return;
|
|
1227
|
+
const nodeModule = require("node:module");
|
|
1228
|
+
if (nodeModule.registerHooks && !process.env.PLAYWRIGHT_FORCE_ASYNC_LOADER) {
|
|
1229
|
+
nodeModule.registerHooks({ resolve, load });
|
|
1230
|
+
return;
|
|
1231
|
+
}
|
|
1232
|
+
if (!nodeModule.register)
|
|
1233
|
+
return;
|
|
1187
1234
|
const { port1, port2 } = new MessageChannel();
|
|
1188
|
-
register(
|
|
1235
|
+
nodeModule.register(import_url2.default.pathToFileURL(require.resolve("../transform/esmLoader.js")), {
|
|
1189
1236
|
data: { port: port2 },
|
|
1190
1237
|
transferList: [port2]
|
|
1191
1238
|
});
|
|
1192
|
-
loaderChannel =
|
|
1193
|
-
return true;
|
|
1194
|
-
}
|
|
1195
|
-
function createPortTransport(port) {
|
|
1196
|
-
return new PortTransport(port, async (method, params) => {
|
|
1239
|
+
loaderChannel = new PortTransport(port1, async (method, params) => {
|
|
1197
1240
|
if (method === "pushToCompilationCache")
|
|
1198
1241
|
addToCompilationCache(params.cache);
|
|
1199
1242
|
});
|
|
1243
|
+
void loaderChannel.send("setSingleTSConfig", { tsconfig: _singleTSConfigPath });
|
|
1244
|
+
void loaderChannel.send("setTransformConfig", { config: _transformConfig });
|
|
1245
|
+
void loaderChannel.send("addToCompilationCache", { cache: serializeCompilationCache() });
|
|
1200
1246
|
}
|
|
1201
1247
|
async function startCollectingFileDeps2() {
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1248
|
+
startCollectingFileDeps();
|
|
1249
|
+
if (loaderChannel)
|
|
1250
|
+
await loaderChannel.send("startCollectingFileDeps", {});
|
|
1205
1251
|
}
|
|
1206
1252
|
async function stopCollectingFileDeps2(file2) {
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1253
|
+
stopCollectingFileDeps(file2);
|
|
1254
|
+
if (loaderChannel)
|
|
1255
|
+
await loaderChannel.send("stopCollectingFileDeps", { file: file2 });
|
|
1210
1256
|
}
|
|
1211
1257
|
async function incorporateCompilationCache() {
|
|
1212
1258
|
if (!loaderChannel)
|
|
@@ -1214,22 +1260,10 @@ async function incorporateCompilationCache() {
|
|
|
1214
1260
|
const result2 = await loaderChannel.send("getCompilationCache", {});
|
|
1215
1261
|
addToCompilationCache(result2.cache);
|
|
1216
1262
|
}
|
|
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
1263
|
|
|
1230
1264
|
// packages/playwright/src/common/configLoader.ts
|
|
1231
1265
|
var { isRegExp: isRegExp2 } = require("playwright-core/lib/coreBundle").iso;
|
|
1232
|
-
var kDefineConfigWasUsed = Symbol("defineConfigWasUsed");
|
|
1266
|
+
var kDefineConfigWasUsed = /* @__PURE__ */ Symbol("defineConfigWasUsed");
|
|
1233
1267
|
var defineConfig = (...configs) => {
|
|
1234
1268
|
let result2 = configs[0];
|
|
1235
1269
|
for (let i = 1; i < configs.length; ++i) {
|
|
@@ -1295,12 +1329,7 @@ async function loadUserConfig(location) {
|
|
|
1295
1329
|
return object;
|
|
1296
1330
|
}
|
|
1297
1331
|
async function loadConfig(location, overrides, ignoreProjectDependencies = false, metadata) {
|
|
1298
|
-
|
|
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();
|
|
1332
|
+
await setSingleTSConfig(overrides?.tsconfig);
|
|
1304
1333
|
const userConfig = await loadUserConfig(location);
|
|
1305
1334
|
validateConfig(location.resolvedConfigFile || "<default config>", userConfig);
|
|
1306
1335
|
const fullConfig = new FullConfigInternal(location, userConfig, overrides || {}, metadata);
|
|
@@ -1314,10 +1343,9 @@ async function loadConfig(location, overrides, ignoreProjectDependencies = false
|
|
|
1314
1343
|
const babelPlugins = userConfig["@playwright/test"]?.babelPlugins || [];
|
|
1315
1344
|
const external = userConfig.build?.external || [];
|
|
1316
1345
|
const jsxImportSource = import_path7.default.dirname(require.resolve("playwright"));
|
|
1317
|
-
setTransformConfig({ babelPlugins, external, jsxImportSource });
|
|
1346
|
+
await setTransformConfig({ babelPlugins, external, jsxImportSource });
|
|
1318
1347
|
if (!overrides?.tsconfig)
|
|
1319
|
-
setSingleTSConfig(fullConfig?.singleTSConfigPath);
|
|
1320
|
-
await configureESMLoaderTransformConfig();
|
|
1348
|
+
await setSingleTSConfig(fullConfig?.singleTSConfigPath);
|
|
1321
1349
|
return fullConfig;
|
|
1322
1350
|
}
|
|
1323
1351
|
function validateConfig(file2, config) {
|
|
@@ -1421,10 +1449,14 @@ function validateConfig(file2, config) {
|
|
|
1421
1449
|
if (typeof config.updateSnapshots !== "string" || !["all", "changed", "missing", "none"].includes(config.updateSnapshots))
|
|
1422
1450
|
throw errorWithFile(file2, `config.updateSnapshots must be one of "all", "changed", "missing" or "none"`);
|
|
1423
1451
|
}
|
|
1452
|
+
if ("retryStrategy" in config && config.retryStrategy !== void 0) {
|
|
1453
|
+
if (typeof config.retryStrategy !== "string" || !["immediate", "isolated"].includes(config.retryStrategy))
|
|
1454
|
+
throw errorWithFile(file2, `config.retryStrategy must be one of "immediate" or "isolated"`);
|
|
1455
|
+
}
|
|
1424
1456
|
if ("tsconfig" in config && config.tsconfig !== void 0) {
|
|
1425
1457
|
if (typeof config.tsconfig !== "string")
|
|
1426
1458
|
throw errorWithFile(file2, `config.tsconfig must be a string`);
|
|
1427
|
-
if (!
|
|
1459
|
+
if (!import_fs7.default.existsSync(import_path7.default.resolve(file2, "..", config.tsconfig)))
|
|
1428
1460
|
throw errorWithFile(file2, `config.tsconfig does not exist`);
|
|
1429
1461
|
}
|
|
1430
1462
|
}
|
|
@@ -1493,7 +1525,7 @@ function resolveConfigLocation(configFile) {
|
|
|
1493
1525
|
}
|
|
1494
1526
|
function resolveConfigFile2(configFileOrDirectory) {
|
|
1495
1527
|
const resolveConfig = (configFile) => {
|
|
1496
|
-
if (
|
|
1528
|
+
if (import_fs7.default.existsSync(configFile))
|
|
1497
1529
|
return configFile;
|
|
1498
1530
|
};
|
|
1499
1531
|
const resolveConfigFileFromDirectory = (directory) => {
|
|
@@ -1503,9 +1535,9 @@ function resolveConfigFile2(configFileOrDirectory) {
|
|
|
1503
1535
|
return configFile;
|
|
1504
1536
|
}
|
|
1505
1537
|
};
|
|
1506
|
-
if (!
|
|
1538
|
+
if (!import_fs7.default.existsSync(configFileOrDirectory))
|
|
1507
1539
|
throw new Error(`${configFileOrDirectory} does not exist`);
|
|
1508
|
-
if (
|
|
1540
|
+
if (import_fs7.default.statSync(configFileOrDirectory).isDirectory()) {
|
|
1509
1541
|
const configFile = resolveConfigFileFromDirectory(configFileOrDirectory);
|
|
1510
1542
|
if (configFile)
|
|
1511
1543
|
return configFile;
|
|
@@ -1529,6 +1561,7 @@ __export(fixtures_exports, {
|
|
|
1529
1561
|
inheritFixtureNames: () => inheritFixtureNames
|
|
1530
1562
|
});
|
|
1531
1563
|
var import_crypto2 = __toESM(require("crypto"));
|
|
1564
|
+
var { filterStackFile } = require("playwright-core/lib/coreBundle").utils;
|
|
1532
1565
|
var kScopeOrder = ["test", "worker"];
|
|
1533
1566
|
function isFixtureTuple(value) {
|
|
1534
1567
|
return Array.isArray(value) && typeof value[1] === "object";
|
|
@@ -1536,6 +1569,11 @@ function isFixtureTuple(value) {
|
|
|
1536
1569
|
function isFixtureOption(value) {
|
|
1537
1570
|
return isFixtureTuple(value) && !!value[1].option;
|
|
1538
1571
|
}
|
|
1572
|
+
function isOptionFixture(registration) {
|
|
1573
|
+
while (!registration.option && registration.super)
|
|
1574
|
+
registration = registration.super;
|
|
1575
|
+
return registration.option;
|
|
1576
|
+
}
|
|
1539
1577
|
var FixturePool = class {
|
|
1540
1578
|
constructor(fixturesList, onLoadError, parentPool, disallowWorkerFixtures, optionOverrides) {
|
|
1541
1579
|
this._registrations = new Map(parentPool ? parentPool._registrations : []);
|
|
@@ -1555,7 +1593,7 @@ var FixturePool = class {
|
|
|
1555
1593
|
if (optionOverrides) {
|
|
1556
1594
|
for (const key of overrideKeys) {
|
|
1557
1595
|
const registration = this._registrations.get(key);
|
|
1558
|
-
if (registration && !registration
|
|
1596
|
+
if (registration && !isOptionFixture(registration))
|
|
1559
1597
|
this._addLoadError(`Fixture "${key}" cannot be overridden in the configuration "use" section. Only fixtures registered with { option: true } can be set in the config.`, optionOverrides.location);
|
|
1560
1598
|
}
|
|
1561
1599
|
}
|
|
@@ -1571,7 +1609,7 @@ var FixturePool = class {
|
|
|
1571
1609
|
options = {
|
|
1572
1610
|
auto: value[1].auto ?? false,
|
|
1573
1611
|
scope: value[1].scope || "test",
|
|
1574
|
-
option:
|
|
1612
|
+
option: value[1].option,
|
|
1575
1613
|
timeout: value[1].timeout,
|
|
1576
1614
|
customTitle: value[1].title,
|
|
1577
1615
|
box: value[1].box
|
|
@@ -1589,6 +1627,10 @@ var FixturePool = class {
|
|
|
1589
1627
|
this._addLoadError(`Fixture "${name}" has already been registered as a { auto: '${previous.scope}' } fixture defined in ${formatLocation(previous.location)}.`, location);
|
|
1590
1628
|
continue;
|
|
1591
1629
|
}
|
|
1630
|
+
if (previous.option !== options.option && options.option !== void 0) {
|
|
1631
|
+
this._addLoadError(`Fixture "${name}" has already been registered as a { option: ${previous.option} } fixture defined in ${formatLocation(previous.location)}.`, location);
|
|
1632
|
+
continue;
|
|
1633
|
+
}
|
|
1592
1634
|
} else if (previous) {
|
|
1593
1635
|
options = { auto: previous.auto, scope: previous.scope, option: previous.option, timeout: previous.timeout, customTitle: previous.customTitle };
|
|
1594
1636
|
} else if (!options) {
|
|
@@ -1603,14 +1645,14 @@ var FixturePool = class {
|
|
|
1603
1645
|
Make it top-level in the test file or put in the configuration file.`, location);
|
|
1604
1646
|
continue;
|
|
1605
1647
|
}
|
|
1606
|
-
if (fn === void 0 &&
|
|
1648
|
+
if (fn === void 0 && previous && isOptionFixture(previous)) {
|
|
1607
1649
|
let original = previous;
|
|
1608
1650
|
while (!original.optionOverride && original.super)
|
|
1609
1651
|
original = original.super;
|
|
1610
1652
|
fn = original.fn;
|
|
1611
1653
|
}
|
|
1612
1654
|
const deps = fixtureParameterNames(fn, location, (e) => this._onLoadError(e));
|
|
1613
|
-
const registration = { id: "", name, location, scope: options.scope, fn, auto: options.auto, option: options.option, timeout: options.timeout, customTitle: options.customTitle, box: options.box, deps, super: previous, optionOverride: isOptionsOverride };
|
|
1655
|
+
const registration = { id: "", name, location, scope: options.scope, fn, auto: options.auto, option: !!options.option, timeout: options.timeout, customTitle: options.customTitle, box: options.box, deps, super: previous, optionOverride: isOptionsOverride };
|
|
1614
1656
|
registrationId(registration);
|
|
1615
1657
|
this._registrations.set(name, registration);
|
|
1616
1658
|
}
|
|
@@ -1694,7 +1736,7 @@ Make it top-level in the test file or put in the configuration file.`, location)
|
|
|
1694
1736
|
this._onLoadError({ message, location });
|
|
1695
1737
|
}
|
|
1696
1738
|
};
|
|
1697
|
-
var signatureSymbol = Symbol("signature");
|
|
1739
|
+
var signatureSymbol = /* @__PURE__ */ Symbol("signature");
|
|
1698
1740
|
function formatPotentiallyInternalLocation(location) {
|
|
1699
1741
|
const isUserFixture = location && filterStackFile(location.file);
|
|
1700
1742
|
return isUserFixture ? formatLocation(location) : "<builtin>";
|
|
@@ -1801,7 +1843,7 @@ __export(ipc_exports, {
|
|
|
1801
1843
|
stdioChunkToParams: () => stdioChunkToParams,
|
|
1802
1844
|
toTestInfoErrorPayload: () => toTestInfoErrorPayload
|
|
1803
1845
|
});
|
|
1804
|
-
var
|
|
1846
|
+
var import_util7 = __toESM(require("util"));
|
|
1805
1847
|
function serializeConfig(config, passCompilationCache) {
|
|
1806
1848
|
const result2 = {
|
|
1807
1849
|
location: { configDir: config.configDir, resolvedConfigFile: config.config.configFile },
|
|
@@ -1818,7 +1860,7 @@ function stdioChunkToParams(chunk) {
|
|
|
1818
1860
|
if (chunk instanceof Uint8Array)
|
|
1819
1861
|
return { buffer: Buffer.from(chunk).toString("base64") };
|
|
1820
1862
|
if (typeof chunk !== "string")
|
|
1821
|
-
return { text:
|
|
1863
|
+
return { text: import_util7.default.inspect(chunk) };
|
|
1822
1864
|
return { text: chunk };
|
|
1823
1865
|
}
|
|
1824
1866
|
function toTestInfoErrorPayload(error) {
|
|
@@ -1903,9 +1945,11 @@ __export(process_exports, {
|
|
|
1903
1945
|
startProcessRunner: () => startProcessRunner
|
|
1904
1946
|
});
|
|
1905
1947
|
var import_bootstrap = require("playwright-core/lib/bootstrap");
|
|
1948
|
+
var import_package4 = require("../package");
|
|
1906
1949
|
var { ManualPromise } = require("playwright-core/lib/coreBundle").iso;
|
|
1907
1950
|
var { setTimeOrigin } = require("playwright-core/lib/coreBundle").iso;
|
|
1908
1951
|
var { startProfiling, stopProfiling } = require("playwright-core/lib/coreBundle").utils;
|
|
1952
|
+
var { setBoxedStackPrefixes } = require("playwright-core/lib/coreBundle").utils;
|
|
1909
1953
|
var ProcessRunner = class {
|
|
1910
1954
|
async gracefullyClose() {
|
|
1911
1955
|
}
|
|
@@ -1926,6 +1970,7 @@ var forceExitInitiated = false;
|
|
|
1926
1970
|
var processRunner;
|
|
1927
1971
|
var processName;
|
|
1928
1972
|
var startingEnv = { ...process.env };
|
|
1973
|
+
setBoxedStackPrefixes([import_package4.packageRoot]);
|
|
1929
1974
|
function startProcessRunner(create) {
|
|
1930
1975
|
sendMessageToParent({ method: "ready" });
|
|
1931
1976
|
process.on("disconnect", () => gracefullyCloseAndExit(true));
|
|
@@ -2175,7 +2220,7 @@ var { monotonicTime } = require("playwright-core/lib/coreBundle").iso;
|
|
|
2175
2220
|
var { raceAgainstDeadline } = require("playwright-core/lib/coreBundle").iso;
|
|
2176
2221
|
var { getPackageManagerExecCommand } = require("playwright-core/lib/coreBundle").utils;
|
|
2177
2222
|
var { currentZone } = require("playwright-core/lib/coreBundle").utils;
|
|
2178
|
-
var testTypeSymbol = Symbol("testType");
|
|
2223
|
+
var testTypeSymbol = /* @__PURE__ */ Symbol("testType");
|
|
2179
2224
|
var TestTypeImpl = class _TestTypeImpl {
|
|
2180
2225
|
constructor(fixtures) {
|
|
2181
2226
|
this.fixtures = fixtures;
|
|
@@ -2224,7 +2269,8 @@ var TestTypeImpl = class _TestTypeImpl {
|
|
|
2224
2269
|
`- You are calling ${title} in a configuration file.`,
|
|
2225
2270
|
`- You are calling ${title} in a file that is imported by the configuration file.`,
|
|
2226
2271
|
`- 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
|
|
2272
|
+
` when one of the dependencies in your package.json depends on @playwright/test.`,
|
|
2273
|
+
`- You are calling ${title} from an async test.describe() block. Only sync ones are supported.`
|
|
2228
2274
|
].join("\n"));
|
|
2229
2275
|
}
|
|
2230
2276
|
return suite;
|
|
@@ -2454,6 +2500,8 @@ var TimeoutError = class extends Error {
|
|
|
2454
2500
|
|
|
2455
2501
|
// packages/playwright/src/isomorphic/teleReceiver.ts
|
|
2456
2502
|
var baseFullConfig = {
|
|
2503
|
+
argv: [],
|
|
2504
|
+
failOnFlakyTests: false,
|
|
2457
2505
|
forbidOnly: false,
|
|
2458
2506
|
fullyParallel: false,
|
|
2459
2507
|
globalSetup: null,
|
|
@@ -2556,6 +2604,13 @@ var Suite = class _Suite extends Base {
|
|
|
2556
2604
|
suite.parent = this;
|
|
2557
2605
|
this._entries.unshift(suite);
|
|
2558
2606
|
}
|
|
2607
|
+
_detach(child) {
|
|
2608
|
+
const idx = this._entries.indexOf(child);
|
|
2609
|
+
if (idx !== -1)
|
|
2610
|
+
this._entries.splice(idx, 1);
|
|
2611
|
+
if (this._entries.length === 0)
|
|
2612
|
+
this.parent?._detach(this);
|
|
2613
|
+
}
|
|
2559
2614
|
allTests() {
|
|
2560
2615
|
const result2 = [];
|
|
2561
2616
|
const visit = (suite) => {
|
|
@@ -2713,6 +2768,7 @@ var TestCase = class _TestCase extends Base {
|
|
|
2713
2768
|
this._projectId = "";
|
|
2714
2769
|
// Explicitly declared tags that are not a part of the title.
|
|
2715
2770
|
this._tags = [];
|
|
2771
|
+
this._planAnnotations = [];
|
|
2716
2772
|
this.fn = fn;
|
|
2717
2773
|
this._testType = testType;
|
|
2718
2774
|
this.location = location;
|
|
@@ -2739,6 +2795,14 @@ var TestCase = class _TestCase extends Base {
|
|
|
2739
2795
|
...this._tags
|
|
2740
2796
|
];
|
|
2741
2797
|
}
|
|
2798
|
+
_applyPlanAnnotation(annotation) {
|
|
2799
|
+
this.annotations.push(annotation);
|
|
2800
|
+
this._planAnnotations.push(annotation);
|
|
2801
|
+
if (annotation.type === "skip" || annotation.type === "fixme")
|
|
2802
|
+
this.expectedStatus = "skipped";
|
|
2803
|
+
else if (annotation.type === "fail" && this.expectedStatus !== "skipped")
|
|
2804
|
+
this.expectedStatus = "failed";
|
|
2805
|
+
}
|
|
2742
2806
|
_serialize() {
|
|
2743
2807
|
return {
|
|
2744
2808
|
kind: "test",
|
|
@@ -2818,7 +2882,7 @@ __export(testLoader_exports, {
|
|
|
2818
2882
|
loadTestFile: () => loadTestFile
|
|
2819
2883
|
});
|
|
2820
2884
|
var import_path9 = __toESM(require("path"));
|
|
2821
|
-
var
|
|
2885
|
+
var import_util11 = __toESM(require("util"));
|
|
2822
2886
|
var import_globals3 = require("../globals");
|
|
2823
2887
|
var defaultTimeout2 = 3e4;
|
|
2824
2888
|
var cachedFileSuites = /* @__PURE__ */ new Map();
|
|
@@ -2830,10 +2894,8 @@ async function loadTestFile(file2, config, testErrors) {
|
|
|
2830
2894
|
suite.location = { file: file2, line: 0, column: 0 };
|
|
2831
2895
|
suite._tags = [...config.config.tags];
|
|
2832
2896
|
(0, import_globals3.setCurrentlyLoadingFileSuite)(suite);
|
|
2833
|
-
if (!(0, import_globals3.isWorkerProcess)())
|
|
2834
|
-
startCollectingFileDeps();
|
|
2897
|
+
if (!(0, import_globals3.isWorkerProcess)())
|
|
2835
2898
|
await startCollectingFileDeps2();
|
|
2836
|
-
}
|
|
2837
2899
|
try {
|
|
2838
2900
|
await requireOrImport(file2);
|
|
2839
2901
|
cachedFileSuites.set(file2, suite);
|
|
@@ -2843,10 +2905,8 @@ async function loadTestFile(file2, config, testErrors) {
|
|
|
2843
2905
|
testErrors.push(serializeLoadError(file2, e));
|
|
2844
2906
|
} finally {
|
|
2845
2907
|
(0, import_globals3.setCurrentlyLoadingFileSuite)(void 0);
|
|
2846
|
-
if (!(0, import_globals3.isWorkerProcess)())
|
|
2847
|
-
stopCollectingFileDeps(file2);
|
|
2908
|
+
if (!(0, import_globals3.isWorkerProcess)())
|
|
2848
2909
|
await stopCollectingFileDeps2(file2);
|
|
2849
|
-
}
|
|
2850
2910
|
}
|
|
2851
2911
|
{
|
|
2852
2912
|
const files = /* @__PURE__ */ new Set();
|
|
@@ -2872,7 +2932,7 @@ function serializeLoadError(file2, error) {
|
|
|
2872
2932
|
} : void 0;
|
|
2873
2933
|
return result2;
|
|
2874
2934
|
}
|
|
2875
|
-
return { value:
|
|
2935
|
+
return { value: import_util11.default.inspect(error) };
|
|
2876
2936
|
}
|
|
2877
2937
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2878
2938
|
0 && (module.exports = {
|
|
@@ -2883,7 +2943,6 @@ function serializeLoadError(file2, error) {
|
|
|
2883
2943
|
config,
|
|
2884
2944
|
configLoader,
|
|
2885
2945
|
defineConfig,
|
|
2886
|
-
esm,
|
|
2887
2946
|
fixtures,
|
|
2888
2947
|
ipc,
|
|
2889
2948
|
mergeTests,
|