Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

ci: show useful check failure output

t8y2b40c71f3921f
diff --git a/scripts/run-check.mjs b/scripts/run-check.mjs
index 3c22585778..7eb0bf4593 100644
--- a/scripts/run-check.mjs
+++ b/scripts/run-check.mjs
@@ -60,6 +60,37 @@ function runTask(task) {
});
}
+function outputFailureExcerpt(output) {
+ const lines = output.trimEnd().split(/\r?\n/);
+ const selected = new Set();
+
+ for (let index = 0; index < lines.length; index += 1) {
+ if (!/\bnot ok\b|AssertionError|ERR_ASSERT|^# fail\b|^# tests\b|^# pass\b/.test(lines[index])) continue;
+ const start = Math.max(0, index - 2);
+ const end = Math.min(lines.length, index + 14);
+ for (let lineIndex = start; lineIndex < end; lineIndex += 1) {
+ selected.add(lineIndex);
+ }
+ }
+
+ if (selected.size === 0) return "";
+
+ const excerpt = [];
+ let previous = -2;
+ for (const index of [...selected].sort((a, b) => a - b)) {
+ if (index > previous + 1 && excerpt.length > 0) excerpt.push("...");
+ excerpt.push(lines[index]);
+ previous = index;
+ }
+ return excerpt.join("\n");
+}
+
+function tailOutput(output, maxLines = 120) {
+ const lines = output.trimEnd().split(/\r?\n/);
+ if (lines.length <= maxLines) return lines.join("\n");
+ return [`... omitted ${lines.length - maxLines} earlier line(s) ...`, ...lines.slice(-maxLines)].join("\n");
+}
+
const results = await Promise.all(tasks.map(runTask));
for (const result of results) {
@@ -73,10 +104,16 @@ const failures = results.filter((result) => result.code !== 0);
for (const failure of failures) {
console.error(`\n${failure.name} output:`);
if (failure.output) {
- console.error(failure.output.trimEnd());
+ const excerpt = outputFailureExcerpt(failure.output);
+ if (excerpt) {
+ console.error("failure excerpt:");
+ console.error(excerpt);
+ console.error("\noutput tail:");
+ }
+ console.error(tailOutput(failure.output));
}
if (failure.errorOutput) {
- console.error(failure.errorOutput.trimEnd());
+ console.error(tailOutput(failure.errorOutput));
}
}