mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
* Add metrics collection and terminal performance tests
* fix: handle Windows drive-letter paths across the codebase
Windows paths like C:\Users\foo\project were broken in multiple places:
- agent-storage slugified D:\MyProject as D:-MyProject (illegal colon)
- terminal-manager rejected all non-/ paths as relative
- bootstrap parser misparsed drive colons as TCP host:port
- daemon/client connection helpers misclassified Windows paths
- CLI cwd filtering used hardcoded / separators
- checkout-git worktree detection used hardcoded / in path checks
- worktree archive used split("/").pop() instead of path.basename()
All path helpers now normalize separators and handle Windows
drive letters with case-insensitive comparison where needed.
54 lines
2.1 KiB
TypeScript
54 lines
2.1 KiB
TypeScript
#!/usr/bin/env npx tsx
|
|
|
|
/**
|
|
* Phase 18: Local daemon utility tests.
|
|
*
|
|
* Tests pure helpers that do not require a running daemon.
|
|
*/
|
|
|
|
import assert from "node:assert";
|
|
import { resolveTcpHostFromListen } from "../src/commands/daemon/local-daemon.js";
|
|
|
|
console.log("=== Local Daemon Utility Helpers ===\n");
|
|
|
|
{
|
|
console.log("Test 1: resolves numeric listen values to localhost host:port");
|
|
assert.strictEqual(resolveTcpHostFromListen("6767"), "127.0.0.1:6767");
|
|
assert.strictEqual(resolveTcpHostFromListen(" 7777 "), "127.0.0.1:7777");
|
|
console.log("✓ resolves numeric listen values\n");
|
|
}
|
|
|
|
{
|
|
console.log("Test 2: preserves explicit host:port listen values");
|
|
assert.strictEqual(resolveTcpHostFromListen("localhost:6767"), "localhost:6767");
|
|
assert.strictEqual(resolveTcpHostFromListen("0.0.0.0:8080"), "0.0.0.0:8080");
|
|
console.log("✓ preserves explicit host:port values\n");
|
|
}
|
|
|
|
{
|
|
console.log("Test 3: rejects unix socket listen values");
|
|
assert.strictEqual(resolveTcpHostFromListen("/tmp/paseo.sock"), null);
|
|
assert.strictEqual(resolveTcpHostFromListen("unix:///tmp/paseo.sock"), null);
|
|
assert.strictEqual(resolveTcpHostFromListen("pipe://\\\\.\\pipe\\paseo-managed-test"), null);
|
|
assert.strictEqual(resolveTcpHostFromListen("\\\\.\\pipe\\paseo-managed-test"), null);
|
|
console.log("✓ rejects unix socket listen values\n");
|
|
}
|
|
|
|
{
|
|
console.log("Test 4: rejects empty and non-host listen values");
|
|
assert.strictEqual(resolveTcpHostFromListen(""), null);
|
|
assert.strictEqual(resolveTcpHostFromListen(" "), null);
|
|
assert.strictEqual(resolveTcpHostFromListen("localhost"), null);
|
|
console.log("✓ rejects empty and non-host listen values\n");
|
|
}
|
|
|
|
{
|
|
console.log("Test 5: rejects Windows absolute paths (not TCP endpoints)");
|
|
assert.strictEqual(resolveTcpHostFromListen("C:\\Users\\foo\\.paseo\\paseo.sock"), null);
|
|
assert.strictEqual(resolveTcpHostFromListen("D:\\project\\socket"), null);
|
|
assert.strictEqual(resolveTcpHostFromListen("C:\\paseo.sock"), null);
|
|
console.log("✓ rejects Windows absolute paths\n");
|
|
}
|
|
|
|
console.log("=== All local daemon utility tests passed ===");
|