patchright-bun 1.58.2 → 1.59.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/ThirdPartyNotices.txt +10 -1133
- package/lib/agents/generateAgents.js +2 -4
- package/lib/common/config.js +4 -5
- package/lib/common/expectBundleImpl.js +221 -221
- package/lib/common/process.js +1 -0
- package/lib/common/test.js +10 -1
- package/lib/common/testType.js +3 -0
- package/lib/common/validators.js +38 -38
- package/lib/errorContext.js +121 -0
- package/lib/index.js +98 -60
- package/lib/isomorphic/teleReceiver.js +26 -9
- package/lib/isomorphic/testServerConnection.js +3 -5
- package/lib/matchers/matchers.js +2 -0
- package/lib/matchers/toMatchAriaSnapshot.js +5 -1
- package/lib/matchers/toMatchSnapshot.js +42 -35
- package/lib/mcp/test/browserBackend.js +45 -22
- package/lib/mcp/test/generatorTools.js +9 -9
- package/lib/mcp/test/plannerTools.js +17 -17
- package/lib/mcp/test/testBackend.js +27 -27
- package/lib/mcp/test/testContext.js +6 -8
- package/lib/mcp/test/testTools.js +9 -9
- package/lib/plugins/webServerPlugin.js +2 -1
- package/lib/program.js +34 -212
- package/lib/reportActions.js +80 -0
- package/lib/reporters/base.js +4 -5
- package/lib/reporters/blob.js +2 -2
- package/lib/reporters/github.js +1 -2
- package/lib/reporters/html.js +64 -31
- package/lib/reporters/junit.js +104 -15
- package/lib/reporters/line.js +1 -1
- package/lib/reporters/list.js +2 -3
- package/lib/reporters/merge.js +47 -26
- package/lib/reporters/multiplexer.js +6 -2
- package/lib/reporters/teleEmitter.js +2 -0
- package/lib/runner/dispatcher.js +6 -14
- package/lib/runner/loadUtils.js +11 -5
- package/lib/runner/projectUtils.js +1 -1
- package/lib/runner/reporters.js +5 -0
- package/lib/runner/tasks.js +11 -8
- package/lib/runner/testRunner.js +2 -2
- package/lib/runner/workerHost.js +0 -3
- package/lib/testActions.js +220 -0
- package/lib/transform/babelBundle.js +0 -3
- package/lib/transform/babelBundleImpl.js +134 -134
- package/lib/transform/compilationCache.js +0 -2
- package/lib/transform/esmLoader.js +8 -6
- package/lib/transform/transform.js +3 -10
- package/lib/utilsBundle.js +0 -7
- package/lib/utilsBundleImpl.js +48 -51
- package/lib/worker/fixtureRunner.js +2 -2
- package/lib/worker/testInfo.js +10 -14
- package/lib/worker/testTracing.js +12 -6
- package/lib/worker/timeoutManager.js +14 -3
- package/lib/worker/workerMain.js +24 -21
- package/package.json +2 -6
- package/types/test.d.ts +83 -12
- package/lib/mcp/browser/browserContextFactory.js +0 -329
- package/lib/mcp/browser/browserServerBackend.js +0 -84
- package/lib/mcp/browser/config.js +0 -421
- package/lib/mcp/browser/context.js +0 -244
- package/lib/mcp/browser/response.js +0 -278
- package/lib/mcp/browser/sessionLog.js +0 -75
- package/lib/mcp/browser/tab.js +0 -343
- package/lib/mcp/browser/tools/common.js +0 -65
- package/lib/mcp/browser/tools/console.js +0 -46
- package/lib/mcp/browser/tools/dialogs.js +0 -60
- package/lib/mcp/browser/tools/evaluate.js +0 -61
- package/lib/mcp/browser/tools/files.js +0 -58
- package/lib/mcp/browser/tools/form.js +0 -63
- package/lib/mcp/browser/tools/install.js +0 -72
- package/lib/mcp/browser/tools/keyboard.js +0 -107
- package/lib/mcp/browser/tools/mouse.js +0 -107
- package/lib/mcp/browser/tools/navigate.js +0 -71
- package/lib/mcp/browser/tools/network.js +0 -63
- package/lib/mcp/browser/tools/open.js +0 -57
- package/lib/mcp/browser/tools/pdf.js +0 -49
- package/lib/mcp/browser/tools/runCode.js +0 -78
- package/lib/mcp/browser/tools/screenshot.js +0 -93
- package/lib/mcp/browser/tools/snapshot.js +0 -173
- package/lib/mcp/browser/tools/tabs.js +0 -67
- package/lib/mcp/browser/tools/tool.js +0 -47
- package/lib/mcp/browser/tools/tracing.js +0 -74
- package/lib/mcp/browser/tools/utils.js +0 -94
- package/lib/mcp/browser/tools/verify.js +0 -143
- package/lib/mcp/browser/tools/wait.js +0 -63
- package/lib/mcp/browser/tools.js +0 -84
- package/lib/mcp/browser/watchdog.js +0 -44
- package/lib/mcp/config.d.js +0 -16
- package/lib/mcp/extension/cdpRelay.js +0 -351
- package/lib/mcp/extension/extensionContextFactory.js +0 -76
- package/lib/mcp/extension/protocol.js +0 -28
- package/lib/mcp/index.js +0 -61
- package/lib/mcp/log.js +0 -35
- package/lib/mcp/program.js +0 -111
- package/lib/mcp/sdk/exports.js +0 -28
- package/lib/mcp/sdk/http.js +0 -152
- package/lib/mcp/sdk/inProcessTransport.js +0 -71
- package/lib/mcp/sdk/server.js +0 -223
- package/lib/mcp/sdk/tool.js +0 -47
- package/lib/mcp/terminal/cli.js +0 -296
- package/lib/mcp/terminal/command.js +0 -56
- package/lib/mcp/terminal/commands.js +0 -333
- package/lib/mcp/terminal/daemon.js +0 -129
- package/lib/mcp/terminal/help.json +0 -32
- package/lib/mcp/terminal/helpGenerator.js +0 -88
- package/lib/mcp/terminal/socketConnection.js +0 -80
- package/lib/runner/storage.js +0 -91
- package/lib/transform/md.js +0 -221
|
@@ -67,8 +67,6 @@ function installSourceMapSupport() {
|
|
|
67
67
|
environment: "node",
|
|
68
68
|
handleUncaughtExceptions: false,
|
|
69
69
|
retrieveSourceMap(source) {
|
|
70
|
-
if (source.startsWith("file://") && !sourceMaps.has(source))
|
|
71
|
-
source = source.substring("file://".length);
|
|
72
70
|
if (!sourceMaps.has(source))
|
|
73
71
|
return null;
|
|
74
72
|
const sourceMapPath = sourceMaps.get(source);
|
|
@@ -51,22 +51,24 @@ const kSupportedFormats = /* @__PURE__ */ new Map([
|
|
|
51
51
|
[null, null],
|
|
52
52
|
[void 0, void 0]
|
|
53
53
|
]);
|
|
54
|
-
async function load(
|
|
55
|
-
const moduleUrl = originalModuleUrl.replace(esmPreflightExtension, "");
|
|
54
|
+
async function load(moduleUrl, context, defaultLoad) {
|
|
56
55
|
if (!kSupportedFormats.has(context.format))
|
|
57
56
|
return defaultLoad(moduleUrl, context, defaultLoad);
|
|
58
57
|
if (!moduleUrl.startsWith("file://"))
|
|
59
58
|
return defaultLoad(moduleUrl, context, defaultLoad);
|
|
60
59
|
const filename = import_url.default.fileURLToPath(moduleUrl);
|
|
60
|
+
const isPreflight = moduleUrl.endsWith(esmPreflightExtension);
|
|
61
61
|
if (!(0, import_transform.shouldTransform)(filename))
|
|
62
62
|
return defaultLoad(moduleUrl, context, defaultLoad);
|
|
63
|
-
const
|
|
64
|
-
const
|
|
63
|
+
const originalModuleUrl = isPreflight ? moduleUrl.slice(0, -esmPreflightExtension.length) : moduleUrl;
|
|
64
|
+
const originalFilename = isPreflight ? import_url.default.fileURLToPath(originalModuleUrl) : filename;
|
|
65
|
+
const code = import_fs.default.readFileSync(originalFilename, "utf-8");
|
|
66
|
+
const transformed = (0, import_transform.transformHook)(code, originalFilename, originalModuleUrl);
|
|
65
67
|
if (transformed.serializedCache)
|
|
66
68
|
transport?.post("pushToCompilationCache", { cache: transformed.serializedCache });
|
|
67
69
|
return {
|
|
68
|
-
format: kSupportedFormats.get(context.format) || ((0, import_util.fileIsModule)(
|
|
69
|
-
source:
|
|
70
|
+
format: kSupportedFormats.get(context.format) || ((0, import_util.fileIsModule)(originalFilename) ? "module" : "commonjs"),
|
|
71
|
+
source: isPreflight ? `void 0;` : transformed.code,
|
|
70
72
|
shortCircuit: true
|
|
71
73
|
};
|
|
72
74
|
}
|
|
@@ -50,7 +50,6 @@ var import_util = require("../util");
|
|
|
50
50
|
var import_utilsBundle = require("../utilsBundle");
|
|
51
51
|
var import_compilationCache = require("./compilationCache");
|
|
52
52
|
var import_pirates = require("../third_party/pirates");
|
|
53
|
-
var import_md = require("./md");
|
|
54
53
|
const version = require("../../package.json").version;
|
|
55
54
|
const cachedTSConfigs = /* @__PURE__ */ new Map();
|
|
56
55
|
let _transformConfig = {
|
|
@@ -186,12 +185,6 @@ function setTransformData(pluginName, value) {
|
|
|
186
185
|
transformData.set(pluginName, value);
|
|
187
186
|
}
|
|
188
187
|
function transformHook(originalCode, filename, moduleUrl) {
|
|
189
|
-
let inputSourceMap;
|
|
190
|
-
if (filename.endsWith(".md") && false) {
|
|
191
|
-
const transformed = transformMDToTS(originalCode, filename);
|
|
192
|
-
originalCode = transformed.code;
|
|
193
|
-
inputSourceMap = transformed.map;
|
|
194
|
-
}
|
|
195
188
|
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));
|
|
196
189
|
const pluginsPrologue = _transformConfig.babelPlugins;
|
|
197
190
|
const pluginsEpilogue = hasPreprocessor ? [[process.env.PW_TEST_SOURCE_TRANSFORM]] : [];
|
|
@@ -202,7 +195,7 @@ function transformHook(originalCode, filename, moduleUrl) {
|
|
|
202
195
|
process.env.BROWSERSLIST_IGNORE_OLD_DATA = "true";
|
|
203
196
|
const { babelTransform } = require("./babelBundle");
|
|
204
197
|
transformData = /* @__PURE__ */ new Map();
|
|
205
|
-
const babelResult = babelTransform(originalCode, filename, !!moduleUrl, pluginsPrologue, pluginsEpilogue
|
|
198
|
+
const babelResult = babelTransform(originalCode, filename, !!moduleUrl, pluginsPrologue, pluginsEpilogue);
|
|
206
199
|
if (!babelResult?.code)
|
|
207
200
|
return { code: originalCode, serializedCache };
|
|
208
201
|
const { code, map } = babelResult;
|
|
@@ -219,7 +212,7 @@ async function requireOrImport(file) {
|
|
|
219
212
|
if (isModule) {
|
|
220
213
|
const fileName = import_url.default.pathToFileURL(file);
|
|
221
214
|
const esmImport = () => eval(`import(${JSON.stringify(fileName)})`);
|
|
222
|
-
await eval(`import(${JSON.stringify(fileName + ".esm.preflight")})`).finally(nextTask);
|
|
215
|
+
await eval(`import(${JSON.stringify(fileName + ".esm.preflight")})`).catch((error) => (0, import_util.debugTest)("Failed to load preflight for " + file + ", source maps may be missing for errors thrown during loading.", error)).finally(nextTask);
|
|
223
216
|
return await esmImport().finally(nextTask);
|
|
224
217
|
}
|
|
225
218
|
const result = require(file);
|
|
@@ -249,7 +242,7 @@ function installTransformIfNeeded() {
|
|
|
249
242
|
import_module.default._resolveFilename = resolveFilename;
|
|
250
243
|
(0, import_pirates.addHook)((code, filename) => {
|
|
251
244
|
return transformHook(code, filename).code;
|
|
252
|
-
}, shouldTransform, [".ts", ".tsx", ".js", ".jsx", ".mjs", ".mts", ".cjs", ".cts"
|
|
245
|
+
}, shouldTransform, [".ts", ".tsx", ".js", ".jsx", ".mjs", ".mts", ".cjs", ".cts"]);
|
|
253
246
|
}
|
|
254
247
|
const collectCJSDependencies = (module2, dependencies) => {
|
|
255
248
|
module2.children.forEach((child) => {
|
package/lib/utilsBundle.js
CHANGED
|
@@ -22,7 +22,6 @@ __export(utilsBundle_exports, {
|
|
|
22
22
|
enquirer: () => enquirer,
|
|
23
23
|
getEastAsianWidth: () => getEastAsianWidth,
|
|
24
24
|
json5: () => json5,
|
|
25
|
-
parseMarkdown: () => parseMarkdown,
|
|
26
25
|
sourceMapSupport: () => sourceMapSupport,
|
|
27
26
|
stoppable: () => stoppable
|
|
28
27
|
});
|
|
@@ -33,18 +32,12 @@ const stoppable = require("./utilsBundleImpl").stoppable;
|
|
|
33
32
|
const enquirer = require("./utilsBundleImpl").enquirer;
|
|
34
33
|
const chokidar = require("./utilsBundleImpl").chokidar;
|
|
35
34
|
const getEastAsianWidth = require("./utilsBundleImpl").getEastAsianWidth;
|
|
36
|
-
const { unified } = require("./utilsBundleImpl").unified;
|
|
37
|
-
const remarkParse = require("./utilsBundleImpl").remarkParse;
|
|
38
|
-
function parseMarkdown(content) {
|
|
39
|
-
return unified().use(remarkParse).parse(content);
|
|
40
|
-
}
|
|
41
35
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
36
|
0 && (module.exports = {
|
|
43
37
|
chokidar,
|
|
44
38
|
enquirer,
|
|
45
39
|
getEastAsianWidth,
|
|
46
40
|
json5,
|
|
47
|
-
parseMarkdown,
|
|
48
41
|
sourceMapSupport,
|
|
49
42
|
stoppable
|
|
50
43
|
});
|