scripts-orchestrator 2.13.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -0
- package/index.js +95 -0
- package/lib/index.js +24 -2
- package/lib/orchestrator.js +347 -130
- package/lib/process-manager.js +5 -2
- package/lib/process-manager.test.js +22 -0
- package/lib/recommend-phases.js +251 -0
- package/lib/recommend-phases.test.js +107 -0
- package/lib/report-html.js +308 -0
- package/lib/report-html.test.js +88 -0
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { renderReportHtml } from './report-html.js';
|
|
2
|
+
|
|
3
|
+
describe('renderReportHtml', () => {
|
|
4
|
+
test('renders a flat payload with a commands table and status badges', () => {
|
|
5
|
+
const html = renderReportHtml({
|
|
6
|
+
success: true,
|
|
7
|
+
timestamp: '2026-06-17T00:00:00.000Z',
|
|
8
|
+
overallDurationMs: 5000,
|
|
9
|
+
commands: [
|
|
10
|
+
{ command: 'build', success: true, durationMs: 2000, logFile: 'logs/build.log' },
|
|
11
|
+
{ command: 'lint', success: false, durationMs: 1000 },
|
|
12
|
+
],
|
|
13
|
+
});
|
|
14
|
+
expect(html).toContain('<!DOCTYPE html>');
|
|
15
|
+
expect(html).toContain('Total time');
|
|
16
|
+
expect(html).toContain('<code>build</code>');
|
|
17
|
+
expect(html).toContain('badge ok');
|
|
18
|
+
expect(html).toContain('badge fail');
|
|
19
|
+
expect(html).toContain('logs/build.log'); // log link rendered
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('running (success: null) renders a Running state, not a failure', () => {
|
|
23
|
+
const html = renderReportHtml({
|
|
24
|
+
success: null,
|
|
25
|
+
timestamp: '2026-06-17T00:00:00.000Z',
|
|
26
|
+
overallDurationMs: 1000,
|
|
27
|
+
commands: [{ command: 'build', success: null, startedAt: '2026-06-17T00:00:00.000Z' }],
|
|
28
|
+
});
|
|
29
|
+
expect(html).toContain('Running…');
|
|
30
|
+
expect(html).toContain('Elapsed'); // elapsed label while running
|
|
31
|
+
expect(html).toContain('badge running');
|
|
32
|
+
expect(html).not.toContain('badge fail');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('renders nested sections as collapsible blocks with their titles', () => {
|
|
36
|
+
const html = renderReportHtml({
|
|
37
|
+
success: false,
|
|
38
|
+
timestamp: '2026-06-17T00:00:00.000Z',
|
|
39
|
+
title: 'Monorepo Quality Report',
|
|
40
|
+
sections: [
|
|
41
|
+
{ title: 'Global checks', success: true, commands: [{ command: 'lint', success: true, durationMs: 100 }] },
|
|
42
|
+
{
|
|
43
|
+
title: 'apps/web',
|
|
44
|
+
success: false,
|
|
45
|
+
statusKind: 'fail',
|
|
46
|
+
meta: { path: 'apps/web', state: 'RUNNING' },
|
|
47
|
+
commands: [{ command: 'test', success: false, durationMs: 200 }],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
expect(html).toContain('Monorepo Quality Report');
|
|
52
|
+
expect(html).toContain('<details');
|
|
53
|
+
expect(html).toContain('Global checks');
|
|
54
|
+
expect(html).toContain('apps/web');
|
|
55
|
+
// meta values rendered opaquely
|
|
56
|
+
expect(html).toContain('RUNNING');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('columns are the union of keys; unknown keys become plain text columns', () => {
|
|
60
|
+
const html = renderReportHtml({
|
|
61
|
+
success: true,
|
|
62
|
+
timestamp: 't',
|
|
63
|
+
commands: [
|
|
64
|
+
{ command: 'a', success: true, durationMs: 10, scope: 'global' },
|
|
65
|
+
{ command: 'b', success: true, memoryKb: 2048 }, // no durationMs, has memory
|
|
66
|
+
],
|
|
67
|
+
});
|
|
68
|
+
// unknown key 'scope' becomes a humanized column header + value
|
|
69
|
+
expect(html).toContain('<th>Scope</th>');
|
|
70
|
+
expect(html).toContain('global');
|
|
71
|
+
// memory column present because at least one row has it
|
|
72
|
+
expect(html).toContain('<th>Memory</th>');
|
|
73
|
+
expect(html).toContain('MB');
|
|
74
|
+
// raw 'success'/'startedAt' are never raw columns
|
|
75
|
+
expect(html).not.toContain('<th>Success</th>');
|
|
76
|
+
expect(html).not.toContain('<th>Started At</th>');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('statusKind drives the badge color for custom states', () => {
|
|
80
|
+
const html = renderReportHtml({
|
|
81
|
+
success: true,
|
|
82
|
+
timestamp: 't',
|
|
83
|
+
sections: [{ title: 'cached', statusKind: 'warn', statusLabel: 'NX CACHE', commands: [] }],
|
|
84
|
+
});
|
|
85
|
+
expect(html).toContain('badge warn');
|
|
86
|
+
expect(html).toContain('NX CACHE');
|
|
87
|
+
});
|
|
88
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scripts-orchestrator",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "A powerful script orchestrator for running parallel commands with dependency management, background processes, and health checks",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|