Skip to content

Commit c6b0953

Browse files
la14-1spawn-qa-botlouisgv
authored
refactor: fix require() usage and stale test README references (#2243)
- Replace require() calls with ESM import in history-spawn-id.test.ts (require() violates ESM-only rule per shell-scripts.md) - Fix stale parseJsonRaw reference in test README (cli parse.ts does not export parseJsonRaw; only packages/shared does) - Add 5 missing test file entries to test README -- qa/code-quality Co-authored-by: spawn-qa-bot <qa@openrouter.ai> Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
1 parent 435bc9c commit c6b0953

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

packages/cli/src/__tests__/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ bun test src/__tests__/manifest.test.ts
6363
- `orchestrate.test.ts``runOrchestration`
6464

6565
### Parsing and type utilities
66-
- `parse.test.ts``parseJsonWith`, `parseJsonRaw`
66+
- `parse.test.ts``parseJsonWith`
6767
- `fuzzy-key-matching.test.ts``findClosestKeyByNameOrKey`, `levenshtein`, `findClosestMatch`, `resolveAgentKey`, `resolveCloudKey`
6868
- `unknown-flags.test.ts` — Unknown flag detection, `KNOWN_FLAGS`, `expandEqualsFlags`
6969
- `custom-flag.test.ts``--custom` flag for AWS, GCP, Hetzner, DigitalOcean
@@ -75,6 +75,17 @@ bun test src/__tests__/manifest.test.ts
7575
- `aws.test.ts` — AWS credential cache, SigV4 signing helpers
7676
- `cloud-init.test.ts``getPackagesForTier`, `needsNode`, `needsBun`, `NODE_INSTALL_CMD`
7777
- `check-entity.test.ts` / `check-entity-messages.test.ts` — Entity validation
78+
- `agent-tarball.test.ts``tryTarballInstall`: GitHub Release tarball install, fallback, URL validation
79+
- `gateway-resilience.test.ts``startGateway` systemd unit with auto-restart and cron heartbeat
80+
81+
### OAuth and auth
82+
- `oauth-code-validation.test.ts``OAUTH_CODE_REGEX` format validation
83+
84+
### History (extended)
85+
- `history-spawn-id.test.ts` — Unique spawn IDs, `saveVmConnection`/`saveLaunchCmd` by spawnId, concurrent spawn isolation
86+
87+
### Manifest (extended)
88+
- `icon-integrity.test.ts` — Icon file existence and format validation
7889

7990
### Support files (not test files)
8091
- `test-helpers.ts` — Shared fixtures: `createMockManifest`, `mockClackPrompts`, `setupTestEnvironment`, etc.

packages/cli/src/__tests__/history-spawn-id.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { homedir } from "node:os";
1818
import { join } from "node:path";
1919
import {
2020
generateSpawnId,
21+
getActiveServers,
2122
getConnectionPath,
2223
getHistoryPath,
2324
loadHistory,
@@ -446,8 +447,7 @@ describe("history spawn IDs", () => {
446447

447448
// getActiveServers triggers mergeLastConnection
448449
const servers = loadHistory();
449-
// Force merge by importing getActiveServers (it calls mergeLastConnection internally)
450-
const { getActiveServers } = require("../history.js");
450+
// Force merge by calling getActiveServers (it calls mergeLastConnection internally)
451451
getActiveServers();
452452

453453
const history = loadHistory();
@@ -475,7 +475,6 @@ describe("history spawn IDs", () => {
475475
};
476476
writeFileSync(getConnectionPath(), JSON.stringify(connData) + "\n");
477477

478-
const { getActiveServers } = require("../history.js");
479478
getActiveServers();
480479

481480
const history = loadHistory();

0 commit comments

Comments
 (0)