The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(coverage): reformat coverage test files to satisfy line length limits
Steven Enamakel9cbb8be7ddb1
diff --git a/scripts/__tests__/nextest-coverage.test.mjs b/scripts/__tests__/nextest-coverage.test.mjsindex 8f7e82cdf0..ad8883a6dd 100644--- a/scripts/__tests__/nextest-coverage.test.mjs+++ b/scripts/__tests__/nextest-coverage.test.mjs@@ -13,14 +13,34 @@ function report(xml, expected = []) {fs.writeFileSync(`${dir}/junit.xml`, xml);fs.writeFileSync(`${dir}/expected`, expected.join("\n"));let status = 0;- try { execFileSync("node", [validator, `${dir}/junit.xml`, `${dir}/counts.json`, `${dir}/expected`], { stdio: "pipe" }); }- catch (error) { status = error.status; }- return { status, counts: fs.existsSync(`${dir}/counts.json`) ? JSON.parse(fs.readFileSync(`${dir}/counts.json`)) : undefined };- } finally { fs.rmSync(dir, { recursive: true, force: true }); }+ try {+ execFileSync(+ "node",+ [+ validator,+ `${dir}/junit.xml`,+ `${dir}/counts.json`,+ `${dir}/expected`,+ ],+ { stdio: "pipe" },+ );+ } catch (error) {+ status = error.status;+ }+ return {+ status,+ counts: fs.existsSync(`${dir}/counts.json`)+ ? JSON.parse(fs.readFileSync(`${dir}/counts.json`))+ : undefined,+ };+ } finally {+ fs.rmSync(dir, { recursive: true, force: true });+ }}test("nextest reports counts for each binary and rejects a missing expected target", () => {- const xml = '<testsuites><testsuite name="openhuman-cli::first" tests="2" failures="1" errors="0" skipped="0"><testcase name="one"/><testcase name="two"/></testsuite></testsuites>';+ const xml =+ '<testsuites><testsuite name="openhuman-cli::first" tests="2" failures="1" errors="0" skipped="0"><testcase name="one"/><testcase name="two"/></testsuite></testsuites>';assert.equal(report(xml, ["first"]).status, 0);assert.equal(report(xml, ["first", "second"]).status, 1);assert.equal(report(xml).counts.tests, 2);@@ -28,11 +48,20 @@ test("nextest reports counts for each binary and rejects a missing expected targ});test("nextest rejects zero tests even when a binary report exists", () => {- assert.equal(report('<testsuites><testsuite name="openhuman-cli::first" tests="0"/></testsuites>', ["first"]).status, 1);+ assert.equal(+ report(+ '<testsuites><testsuite name="openhuman-cli::first" tests="0"/></testsuites>',+ ["first"],+ ).status,+ 1,+ );});test("nextest serialization retains JSON-RPC and multi-server suites", () => {- const config = fs.readFileSync(path.join(root, ".config/nextest.toml"), "utf8");+ const config = fs.readFileSync(+ path.join(root, ".config/nextest.toml"),+ "utf8",+ );assert.match(config, /binary\(=json_rpc_e2e\)/);assert.match(config, /binary\(=mcp_registry_multi_server\)/);});diff --git a/scripts/__tests__/rust-coverage-status.test.mjs b/scripts/__tests__/rust-coverage-status.test.mjsindex eeffa53375..fb6fa299b7 100644--- a/scripts/__tests__/rust-coverage-status.test.mjs+++ b/scripts/__tests__/rust-coverage-status.test.mjs@@ -165,19 +165,26 @@ for (const [label, scriptPath, invoke] of [});}-for (const helper of ["llvm_cov", "llvm_cov_package", "llvm_cov_product_facade"]) {+for (const helper of [+ "llvm_cov",+ "llvm_cov_package",+ "llvm_cov_product_facade",+]) {test(`${helper} selects nextest for private suites and rejects empty selections`, () => {const result = withRunnerFunctions([helper],[- 'OH_COV_RUNNER=nextest',- 'CORE_PRODUCT_FEATURES=channels',+ "OH_COV_RUNNER=nextest",+ "CORE_PRODUCT_FEATURES=channels",'bash() { printf "%s\\n" "$*"; }',].join("\n"),`${helper} --no-report -p openhuman-embed --all-targets`,);assert.equal(result.status, 0, result.output);- assert.match(result.output, /cargo llvm-cov nextest --profile ci --no-tests=fail/);+ assert.match(+ result.output,+ /cargo llvm-cov nextest --profile ci --no-tests=fail/,+ );assert.match(result.output, /--no-report -p openhuman-embed --all-targets/);});}@@ -187,38 +194,57 @@ test("private core coverage runs sequentially without a second target directory"assert.doesNotMatch(source, /UNIT_PID|cov-unit|export CARGO_TARGET_DIR/);assert.match(source, /suite "openhuman lib\+bins \(nextest\)" llvm_cov/);assert.match(source, /suite "openhuman-embed \(default\)" llvm_cov_package/);- assert.match(source, /suite "openhuman-tinyhumans \(default\)" llvm_cov_package/);+ assert.match(+ source,+ /suite "openhuman-tinyhumans \(default\)" llvm_cov_package/,+ );});test("coverage finalizer retains interrupted reports and the cancellation status", () => {const result = withRunnerFunctions(["preserve_coverage"],[- 'OUT=interrupted.info',- 'COVERAGE_REPORTED=0',+ "OUT=interrupted.info",+ "COVERAGE_REPORTED=0",'log() { printf "%s\\n" "$*"; }','llvm_cov() { printf "REPORT %s\\n" "$*"; return 9; }',].join("\n"),- 'trap preserve_coverage EXIT; exit 143',+ "trap preserve_coverage EXIT; exit 143",);assert.equal(result.status, 143, result.output);- assert.match(result.output, /REPORT report --lcov --output-path interrupted.info/);+ assert.match(+ result.output,+ /REPORT report --lcov --output-path interrupted.info/,+ );});function runMockedCoverage(exitCode) {const dir = fs.mkdtempSync(path.join(os.tmpdir(), "rust-coverage-runner-"));try {- for (const folder of ["bin", "scripts/ci", "crates/openhuman-cli", ".config", "tests"])+ for (const folder of [+ "bin",+ "scripts/ci",+ "crates/openhuman-cli",+ ".config",+ "tests",+ ])fs.mkdirSync(path.join(dir, folder), { recursive: true });- const write = (name, content) => fs.writeFileSync(path.join(dir, name), content, { mode: 0o755 });- for (const name of ["scripts/ci/nextest-coverage.sh", "scripts/ci/nextest-report.mjs", ".config/nextest.toml"])+ const write = (name, content) =>+ fs.writeFileSync(path.join(dir, name), content, { mode: 0o755 });+ for (const name of [+ "scripts/ci/nextest-coverage.sh",+ "scripts/ci/nextest-report.mjs",+ ".config/nextest.toml",+ ])fs.copyFileSync(path.join(repoRoot, name), path.join(dir, name));write("scripts/ci/product-features.sh", "#!/bin/bash\necho channels\n");write("scripts/ci-cancel-aware.sh", '#!/bin/bash\nexec "$@"\n');write("scripts/ci/assert-coverage-presence.sh", "#!/bin/bash\nexit 0\n");write("crates/openhuman-cli/Cargo.toml", "");write("bin/rustup", "#!/bin/bash\nexit 1\n");- write("bin/cargo", `#!/bin/bash+ write(+ "bin/cargo",+ `#!/bin/bashprintf '%s\\n' "$*" >> "$MOCK_CALLS"case "$*" in *"-p openhuman --lib --bins"*) [ "${exitCode}" = 0 ] || exit "${exitCode}" ;; esacnode - "$@" <<'JS'@@ -231,17 +257,31 @@ if (pos >= 0) {fs.writeFileSync(report, '<testsuites><testsuite name="mock" tests="1"></testsuite></testsuites>');}JS-`);+`,+ );let status = 0;try {execFileSync("bash", [runner], {cwd: dir,- env: { ...process.env, PATH: `${dir}/bin:${process.env.PATH}`, MOCK_CALLS: `${dir}/calls`, OH_COV_RUNNER: "nextest", OH_COV_DOCTESTS: "0" },+ env: {+ ...process.env,+ PATH: `${dir}/bin:${process.env.PATH}`,+ MOCK_CALLS: `${dir}/calls`,+ OH_COV_RUNNER: "nextest",+ OH_COV_DOCTESTS: "0",+ },stdio: "pipe",});- } catch (error) { status = error.status; }- return { status, calls: fs.readFileSync(`${dir}/calls`, "utf8").trim().split("\n") };- } finally { fs.rmSync(dir, { recursive: true, force: true }); }+ } catch (error) {+ status = error.status;+ }+ return {+ status,+ calls: fs.readFileSync(`${dir}/calls`, "utf8").trim().split("\n"),+ };+ } finally {+ fs.rmSync(dir, { recursive: true, force: true });+ }}test("private coverage executes every package configuration once and reports after a failed suite", () => {@@ -251,15 +291,28 @@ test("private coverage executes every package configuration once and reports aftassert.equal(selections.length, 8);assert.equal(new Set(selections).size, 8);assert.ok(selections.every((line) => line.includes("--no-tests=fail")));- assert.ok(selections.some((line) => line.includes("-p openhuman-cli --tests -E kind(test)")));- assert.equal(calls.filter((line) => line.includes("llvm-cov report")).length, 1);+ assert.ok(+ selections.some((line) =>+ line.includes("-p openhuman-cli --tests -E kind(test)"),+ ),+ );+ assert.equal(+ calls.filter((line) => line.includes("llvm-cov report")).length,+ 1,+ );});test("private coverage cancels remaining suites but still preserves a report", () => {const { status, calls } = runMockedCoverage(143);assert.equal(status, 143);- assert.equal(calls.filter((line) => line.includes("llvm-cov nextest")).length, 1);- assert.equal(calls.filter((line) => line.includes("llvm-cov report")).length, 1);+ assert.equal(+ calls.filter((line) => line.includes("llvm-cov nextest")).length,+ 1,+ );+ assert.equal(+ calls.filter((line) => line.includes("llvm-cov report")).length,+ 1,+ );});test("private coverage passes when all eight selected configurations report tests", () => {