Initial import: open-design source for helix-mind.ai distribution
Some checks failed
ci / Validate workspace (push) Successful in 12m32s
landing-page-ci / Validate landing page (push) Successful in 9m41s
landing-page-deploy / Deploy landing page (push) Failing after 5m23s
github-metrics / Generate repository metrics SVG (push) Failing after 2m6s
refresh-contributors-wall / Refresh contributors wall cache bust (push) Failing after 12s
Some checks failed
ci / Validate workspace (push) Successful in 12m32s
landing-page-ci / Validate landing page (push) Successful in 9m41s
landing-page-deploy / Deploy landing page (push) Failing after 5m23s
github-metrics / Generate repository metrics SVG (push) Failing after 2m6s
refresh-contributors-wall / Refresh contributors wall cache bust (push) Failing after 12s
This repository contains the open-design daemon CLI source code, built and packaged at https://helix-mind.ai/cli/open-design/latest.tgz for use by the HelixMind /design slash command. Licenses: Apache-2.0 (root) + MIT (skills/*)
This commit is contained in:
67
tools/dev/tests/diagnostics.test.ts
Normal file
67
tools/dev/tests/diagnostics.test.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
|
||||
import {
|
||||
appendStartupLogDiagnostics,
|
||||
createStartupLogDiagnostics,
|
||||
detectLogDiagnostics,
|
||||
} from "../src/diagnostics.js";
|
||||
|
||||
describe("tools-dev diagnostics", () => {
|
||||
it("detects native addon ABI mismatches", () => {
|
||||
const diagnostics = detectLogDiagnostics([
|
||||
"Error: The module '/repo/node_modules/better-sqlite3/build/Release/better_sqlite3.node'",
|
||||
"was compiled against a different Node.js version using",
|
||||
"NODE_MODULE_VERSION 127. This version of Node.js requires",
|
||||
"NODE_MODULE_VERSION 137. Please try re-compiling or re-installing",
|
||||
]);
|
||||
|
||||
assert.equal(diagnostics.length, 1);
|
||||
assert.match(diagnostics[0].message, /native Node addon ABI mismatch/);
|
||||
assert.match(diagnostics[0].recommendation, /rebuild better-sqlite3 --pending/);
|
||||
assert.match(diagnostics[0].recommendation, /pnpm install/);
|
||||
});
|
||||
|
||||
it("detects missing Next.js package resolution during web startup", () => {
|
||||
const diagnostics = detectLogDiagnostics([
|
||||
"Turbopack build failed with 1 errors:",
|
||||
"./apps/web/app",
|
||||
"Error: Next.js inferred your workspace root, but it may not be correct.",
|
||||
"We couldn't find the Next.js package (next/package.json) from the project directory: /repo/apps/web/app",
|
||||
]);
|
||||
|
||||
assert.equal(diagnostics.length, 1);
|
||||
assert.match(diagnostics[0].message, /Next\.js package is not resolvable/);
|
||||
assert.match(diagnostics[0].recommendation, /apps\/web\/node_modules\/next/);
|
||||
assert.match(diagnostics[0].recommendation, /pnpm install --frozen-lockfile/);
|
||||
});
|
||||
|
||||
it("detects missing Next.js package resolution when details change", () => {
|
||||
const diagnostics = detectLogDiagnostics([
|
||||
"Error: We couldn't find the Next.js package from the project directory: /repo/apps/web/app",
|
||||
]);
|
||||
|
||||
assert.equal(diagnostics.length, 1);
|
||||
assert.match(diagnostics[0].message, /Next\.js package is not resolvable/);
|
||||
});
|
||||
|
||||
it("does not report diagnostics for unrelated logs", () => {
|
||||
assert.deepEqual(detectLogDiagnostics(["daemon booting", "ready"]), []);
|
||||
});
|
||||
|
||||
it("appends log tails and recommendations to startup timeout errors", () => {
|
||||
const error = appendStartupLogDiagnostics(
|
||||
new Error("daemon did not expose status in time"),
|
||||
"daemon",
|
||||
createStartupLogDiagnostics("/tmp/daemon.log", [
|
||||
"better_sqlite3.node was compiled against a different Node.js version using",
|
||||
"NODE_MODULE_VERSION 127. This version of Node.js requires NODE_MODULE_VERSION 137.",
|
||||
]),
|
||||
);
|
||||
|
||||
assert.match(error.message, /daemon did not expose status in time/);
|
||||
assert.match(error.message, /daemon log tail \(\/tmp\/daemon\.log\)/);
|
||||
assert.match(error.message, /better_sqlite3\.node/);
|
||||
assert.match(error.message, /pnpm --filter @open-design\/daemon rebuild better-sqlite3 --pending/);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user