test: adapt main's diagnostics tests to the merged designs

cli-lock asserts typed ServerLockError (errno + lock path) instead of
the log-and-return shape the merge didn't keep, dropping only the one
duplicate of server-lock-errors coverage; the liveness tripwire exempts
error-handling.ts as the sanctioned tasklist site; snapshot and
compare-board wrappers pass the now-mandatory browser-manager arg;
background.js's test pins that the retired sidebar-command type is
rejected pre-gate with no response fields.
This commit is contained in:
Garry Tan
2026-08-15 10:44:09 -07:00
parent 1e0fd96c15
commit 08532462c0
7 changed files with 108 additions and 46 deletions
+13 -5
View File
@@ -15,12 +15,20 @@ const SCRIPT = join(import.meta.dir, '..', '..', 'bin', 'gstack-config');
let stateDir: string;
function run(args: string[] = [], extraEnv: Record<string, string> = {}) {
// The script resolves its state dir as GSTACK_STATE_ROOT > GSTACK_HOME >
// GSTACK_STATE_DIR > $HOME/.gstack. Strip the higher-precedence vars so a
// stray value in the harness env (another test file's leftovers, operator
// shell) can never outrank the per-test GSTACK_STATE_DIR isolation.
const env: Record<string, string | undefined> = {
...process.env,
GSTACK_STATE_DIR: stateDir,
};
delete env.GSTACK_STATE_ROOT;
delete env.GSTACK_HOME;
Object.assign(env, extraEnv); // per-test overrides always win, deliberately
const result = Bun.spawnSync(['bash', SCRIPT, ...args], {
env: {
...process.env,
GSTACK_STATE_DIR: stateDir,
...extraEnv,
},
env,
stdout: 'pipe',
stderr: 'pipe',
});