fix: handle web-probe screenshot transport parse failures
This commit is contained in:
@@ -513,7 +513,8 @@ export function runNodeWebProbeScreenshot(options: NodeWebProbeScreenshotOptions
|
||||
"30000",
|
||||
...(options.keepRemote ? ["--keep-remote"] : []),
|
||||
], repoRoot, { input: script, timeoutMs: options.commandTimeoutSeconds * 1000 });
|
||||
const transport = parseJsonObject(result.stdout);
|
||||
const transport = record(parseJsonObject(result.stdout));
|
||||
const transportParsed = Object.keys(transport).length > 0;
|
||||
const artifacts = Array.isArray(transport.artifacts) ? transport.artifacts.map(record) : [];
|
||||
const screenshot = artifacts.find((artifact) => {
|
||||
const remotePath = typeof artifact.remotePath === "string" ? artifact.remotePath : "";
|
||||
@@ -529,11 +530,13 @@ export function runNodeWebProbeScreenshot(options: NodeWebProbeScreenshotOptions
|
||||
? null
|
||||
: result.timedOut
|
||||
? "web-probe-screenshot-command-timeout"
|
||||
: transport.ok === false
|
||||
? "web-probe-screenshot-remote-failed"
|
||||
: screenshot === null
|
||||
? "web-probe-screenshot-artifact-missing"
|
||||
: "web-probe-screenshot-download-unverified";
|
||||
: !transportParsed
|
||||
? "web-probe-screenshot-transport-unparseable"
|
||||
: transport.ok === false
|
||||
? "web-probe-screenshot-remote-failed"
|
||||
: screenshot === null
|
||||
? "web-probe-screenshot-artifact-missing"
|
||||
: "web-probe-screenshot-download-unverified";
|
||||
return {
|
||||
ok,
|
||||
status: ok ? "pass" : "blocked",
|
||||
|
||||
Reference in New Issue
Block a user