fix: announce demo browser only after CDP is ready
This commit is contained in:
@@ -6,7 +6,7 @@ import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { describe, it } from "node:test";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { probeEnv } from "../scripts/smoke-demo-runtime.mjs";
|
||||
import { formatProbeError, probeEnv } from "../scripts/smoke-demo-runtime.mjs";
|
||||
|
||||
const script = fileURLToPath(new URL("../scripts/smoke-demo-runtime.mjs", import.meta.url));
|
||||
|
||||
@@ -80,6 +80,19 @@ describe("demo standalone dependency gate", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves nested fetch/socket causes without dumping headers or environment", () => {
|
||||
const socket = Object.assign(new Error("connect ECONNREFUSED"), { code: "ECONNREFUSED", address: "127.0.0.1", port: 54321 });
|
||||
const cause = new AggregateError([socket], "connection failed");
|
||||
const error = Object.assign(new TypeError("fetch failed", { cause }), { headers: { authorization: "private-header" }, env: { TOKEN: "private-token" } });
|
||||
const output = formatProbeError(error);
|
||||
assert.match(output, /fetch failed/);
|
||||
assert.match(output, /connection failed/);
|
||||
assert.match(output, /ECONNREFUSED/);
|
||||
assert.match(output, /127\.0\.0\.1/);
|
||||
assert.match(output, /54321/);
|
||||
assert.doesNotMatch(output, /private-header|private-token|authorization|TOKEN/);
|
||||
});
|
||||
|
||||
it("strips secrets and uses only scratch data/auth/profile locations", () => {
|
||||
const original = { PATH: "/bin", API_KEY: "fake", GH_TOKEN: "fake", MY_SECRET: "fake", PASSWORD: "fake", NODE_OPTIONS: "--require anything", NODE_PATH: "/outside", ELECTRON_RUN_AS_NODE: "1", LH_DEV_URL: "http://localhost", LH_DATA_DIR: "/real", LH_AUTH_FILE: "/real/auth.json", GOOGLE_APPLICATION_CREDENTIALS: "/real/google.json", AWS_SHARED_CREDENTIALS_FILE: "/real/aws", AWS_PROFILE: "real-profile", CLOUDSDK_CONFIG: "/real/gcloud" };
|
||||
const env = probeEnv(original, "/scratch");
|
||||
|
||||
Reference in New Issue
Block a user