Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project are documented in this file.

## [Unreleased]

### Fixed

- **m87 全局安装探测测试(Windows)**:`exists` mock 用 `path.includes("\\")` 猜平台。win32 上 `path.join("/usr/lib/node_modules", …)` 仍含反斜杠,POSIX 用例被当成 Windows 路径比较,导致 `found` 为 undefined、`validate-platforms (windows-latest)` 失败。现按用例传入明确 npm root。

## [1.19.2] - 2026-09-15

### Fixed — 跨平台加固(Windows / Linux / macOS)
Expand Down
15 changes: 10 additions & 5 deletions tests/m87-zcode-host.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,21 @@ describe("M87 ZCode host", () => {
const expected = (root: string) =>
join(root, "@roarpeng", "graphflow", "dist", "surfaces", "mcp", "server.js");
// BOM + CRLF (Windows npm), banner line before the path, blank lines.
for (const raw of [
"\uFEFFC:\\npm\\node_modules\r\n",
"npm warn config\r\n\r\nC:\\npm\\node_modules\r\n",
"\n\n/usr/lib/node_modules\n\n",
// Pass the npm root per case — do not guess from `path.includes("\\")`.
// On win32, `path.join("/usr/lib/node_modules", ...)` still contains
// backslashes, so that heuristic treats a POSIX root as a Windows path
// and the mock `exists` returns false (`found` undefined).
for (const { raw, root } of [
{ raw: "\uFEFFC:\\npm\\node_modules\r\n", root: "C:\\npm\\node_modules" },
{ raw: "npm warn config\r\n\r\nC:\\npm\\node_modules\r\n", root: "C:\\npm\\node_modules" },
{ raw: "\n\n/usr/lib/node_modules\n\n", root: "/usr/lib/node_modules" },
]) {
const found = resolveGlobalGraphflowInstall({
runNpmRoot: () => raw,
exists: (p) => p === expected(p.includes("\\") ? "C:\\npm\\node_modules" : "/usr/lib/node_modules"),
exists: (p) => p === expected(root),
});
expect(found).toBeDefined();
expect(found?.runtimeRoot).toBe(join(root, "@roarpeng", "graphflow"));
}
});

Expand Down