fix(cli): remove unused createServer import and fix flaky port test

- Remove unused `createServer` import from web-dir.ts (only `Socket`
  is used) — fixes the lint error in CI
- Mock `isPortAvailable` in the "uses port 3000" test so it doesn't
  depend on port 3000 actually being free on the host machine

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
suraj-markup 2026-03-01 21:41:08 +05:30
parent 06ba99eeb4
commit dfcc0841ec
2 changed files with 5 additions and 1 deletions

View File

@ -42,6 +42,10 @@ describe("init command", () => {
tmpDir = mkdtempSync(join(tmpdir(), "ao-init-test-"));
const outputPath = join(tmpDir, "agent-orchestrator.yaml");
// Mock isPortAvailable so test doesn't depend on actual port 3000 being free
const webDirModule = await import("../../src/lib/web-dir.js");
vi.spyOn(webDirModule, "isPortAvailable").mockResolvedValue(true);
const program = new Command();
program.exitOverride();
registerInit(program);

View File

@ -3,7 +3,7 @@
* Shared utility to avoid duplication between dashboard.ts and start.ts.
*/
import { createServer, Socket } from "node:net";
import { Socket } from "node:net";
import { createRequire } from "node:module";
import { fileURLToPath } from "node:url";
import { resolve, dirname } from "node:path";