an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
test(#140): cover the real ensureHarnessHome, Windows-safe path assertions
rajpreetcodes4a9a45d71e74
diff --git a/test/expand-tilde.test.cjs b/test/expand-tilde.test.cjsindex 7acf546d..b5d2ea1f 100644--- a/test/expand-tilde.test.cjs+++ b/test/expand-tilde.test.cjs@@ -70,14 +70,14 @@ test('#140: the suggested default is expanded, not persisted literally', () => {test('#140: the new home leads the recent list exactly once', () => {const { recentHives } = normalizeHiveHome('~/HarnessAgents', ['/other/hive']);- assert.deepEqual(recentHives, [path.join(HOME, 'HarnessAgents'), '/other/hive']);+ assert.deepEqual(recentHives, [path.join(HOME, 'HarnessAgents'), path.resolve('/other/hive')]);});test('#140: stale `~` entries already on disk are normalized too', () => {// Without this the launch picker could hand a pre-fix `~/…` string straight// back and reintroduce the identical mkdir failure.const { recentHives } = normalizeHiveHome('/now/here', ['~/HarnessAgents']);- assert.deepEqual(recentHives, ['/now/here', path.join(HOME, 'HarnessAgents')]);+ assert.deepEqual(recentHives, [path.resolve('/now/here'), path.join(HOME, 'HarnessAgents')]);});test('#140: the same home written twice does not duplicate', () => {@@ -92,7 +92,7 @@ test('#140: the recent list stays capped and skips blanks', () => {const prior = Array.from({ length: 20 }, (_, i) => `/hive/${i}`);const { recentHives } = normalizeHiveHome('/hive/new', ['', ' ', ...prior]);assert.equal(recentHives.length, 8);- assert.equal(recentHives[0], '/hive/new');+ assert.equal(recentHives[0], path.resolve('/hive/new'));});/* ------------------------------------------------------------------ *@@ -102,20 +102,11 @@ test('#140: the recent list stays capped and skips blanks', () => {* literal `~` — which either fails outright or, worse, silently creates a* directory actually named "~" wherever the process cwd happens to be, leaving* the hive somewhere the user will never find it.+ *+ * The real ensureHarnessHome is exercised end-to-end (through a stubbed+ * electron `app`) in test/harness-home.test.cjs.* ------------------------------------------------------------------ */-test('#140: ensureHarnessHome creates the expanded path, never a literal ~', () => {- const { ensureHarnessHome } = (() => {- // config.ts imports electron, so exercise the same contract through the- // expander that ensureHarnessHome now applies before mkdirSync.- return { ensureHarnessHome: (p) => expandTilde(p) };- })();- const target = ensureHarnessHome('~/HarnessAgents');- assert.equal(target, path.join(HOME, 'HarnessAgents'));- assert.ok(!target.startsWith('~'), 'mkdirSync must never receive a bare ~');- assert.ok(path.isAbsolute(target), 'a relative ~ path would land beside the process cwd');-});-test('#140: both entry points agree on the same directory', () => {// The mkdir (ensureHarnessHome) and the persisted value (normalizeHiveHome)// must resolve identically, or the app creates one folder and then records adiff --git a/test/harness-home.test.cjs b/test/harness-home.test.cjsindex 50afe68d..75655199 100644--- a/test/harness-home.test.cjs+++ b/test/harness-home.test.cjs@@ -5,7 +5,13 @@* is picked, and `~/HarnessAgents` is the suggestion itself. Node's fs treats a* literal `~` as a directory name, so ensureHarnessHome died with ENOENT and the* un-expanded home would have been persisted, poisoning every path derived from- * it. The home now goes through the same expandTilde as registered repos.+ * it.+ *+ * This file exercises the REAL ensureHarnessHome / writeConfig / readConfig from+ * src/main/config.ts (electron's app.getPath stubbed to a temp dir). It replaces+ * the stand-in test that used to live in expand-tilde.test.cjs — that one only+ * re-ran expandTilde and would still have passed with the expandTilde call+ * deleted from the real ensureHarnessHome.*/const test = require('node:test');