The fastest browser for AI agents to run browser automation, built for sharing your logged-in browser state with your AI agents, like Codex or Claude Code, without disturbing you. Zero cost, zero config.
JavaScript agent-skillsai-agentautomationbrowserbrowser-automationclaude-codecodexhermes-agentskillsskills-sh
test(ego-browser): simplify e2e result reporting
Autea52e0ec81594
diff --git a/package/ego-browser/scripts/real-browser-e2e/ego-source.mjs b/package/ego-browser/scripts/real-browser-e2e/ego-source.mjsindex 5c1ed21..86e8564 100644--- a/package/ego-browser/scripts/real-browser-e2e/ego-source.mjs+++ b/package/ego-browser/scripts/real-browser-e2e/ego-source.mjs@@ -250,10 +250,8 @@ export function egoSource(body, context) {try {${body}cliLog(JSON.stringify({ ok: true, assertions: __assertionCount }));- await writeFile(join(tempDir, "case-result.json"), JSON.stringify({ ok: true, assertions: __assertionCount }));} catch (error) {cliLog(JSON.stringify({ ok: false, assertions: __assertionCount, error: error.message }));- await writeFile(join(tempDir, "case-result.json"), JSON.stringify({ ok: false, assertions: __assertionCount, error: error.message })).catch(() => {});error.message = ${JSON.stringify("real browser e2e")} + ": " + error.message;throw error;}diff --git a/package/ego-browser/scripts/real-browser-e2e/runner.mjs b/package/ego-browser/scripts/real-browser-e2e/runner.mjsindex 402c0eb..866eafb 100644--- a/package/ego-browser/scripts/real-browser-e2e/runner.mjs+++ b/package/ego-browser/scripts/real-browser-e2e/runner.mjs@@ -1,11 +1,4 @@-import {- mkdir,- mkdtemp,- readFile,- rm,- stat,- writeFile,-} from "node:fs/promises";+import { mkdir, mkdtemp, rm, stat, writeFile } from "node:fs/promises";import { tmpdir } from "node:os";import { dirname, join } from "node:path";import { fileURLToPath } from "node:url";@@ -49,14 +42,21 @@ export async function runRealBrowserE2e() {});const startedAt = Date.now();try {- const { stdout } = await runCommand("ego-browser", egoBrowserArgs, {- cwd: packageDir,- egoBrowserSdkPath,- input: source,- timeoutMs,- });+ const { stdout, stderr } = await runCommand(+ "ego-browser",+ egoBrowserArgs,+ {+ cwd: packageDir,+ egoBrowserSdkPath,+ input: source,+ timeoutMs,+ },+ );const durationMs = Date.now() - startedAt;- const assertions = await readCaseAssertionCount(tempDir, stdout);+ const assertions = extractAssertionCount(stdout, stderr);+ if (assertions === null) {+ throw new Error(`${name} produced no assertion summary`);+ }recordResult(name, "pass", durationMs, assertions);console.log(`-- ${name} passed (${formatDuration(durationMs)}, ${assertions} assertions)`,@@ -64,7 +64,8 @@ export async function runRealBrowserE2e() {} catch (error) {const durationMs = Date.now() - startedAt;const message = error?.message || String(error);- const assertions = await readCaseAssertionCount(tempDir, error?.stdout);+ const assertions =+ extractAssertionCount(error?.stdout, error?.stderr) ?? 0;recordResult(name, "fail", durationMs, assertions, message);console.error(`[FAIL] ${name} (${formatDuration(durationMs)}): ${message}`,@@ -136,7 +137,6 @@ export async function runRealBrowserE2e() {}async function cleanupTaskSpace() {- const beforeFails = caseResults.filter((r) => r.status === "fail").length;await runEgoCase("cleanup",`@@ -269,22 +269,9 @@ async function initializeE2eEnvironment(context, tempDir) {);}-async function readCaseAssertionCount(tempDir, stdout) {- const resultPath = join(tempDir, "case-result.json");- try {- const raw = await readFile(resultPath, "utf8");- const parsed = JSON.parse(raw);- if (typeof parsed.assertions === "number") return parsed.assertions;- } catch {- // file not written or not valid JSON — fall back to stdout- }- return extractAssertionCount(stdout);-}--function extractAssertionCount(stdout) {- if (!stdout) return 0;+function extractAssertionCount(...outputs) {// Find the last JSON line with "assertions" from cliLog output- const lines = stdout.split("\n");+ const lines = outputs.filter(Boolean).join("\n").split("\n");for (let i = lines.length - 1; i >= 0; i--) {const line = lines[i].trim();if (line.startsWith("{") && line.includes("assertions")) {@@ -296,7 +283,7 @@ function extractAssertionCount(stdout) {}}}- return 0;+ return null;}function formatDuration(ms) {diff --git a/package/ego-browser/src/learning/index.ts b/package/ego-browser/src/learning/index.tsindex ac7e47f..86784e4 100644--- a/package/ego-browser/src/learning/index.ts+++ b/package/ego-browser/src/learning/index.ts@@ -5,12 +5,10 @@ import { isAbsolute, relative, resolve } from "node:path";import {iterLearningDirs,learningEntry,- learningsRoot,loadLearningManifest,siteSkillsForUrl,siteSkillsRoot,urlHostname,- LearningEntry,LearningManifest,LearnedContext,LearnedKnowledgeNote,@@ -18,11 +16,6 @@ import {NodeToolSchema,ToolSchema,} from "./check-domain-learning.js";-import {- validateLearning,- validateLearnings,- validateSiteSkills,-} from "./validate-learning-format.js";export {checkDomainLearningExists,