Apply user priority: save/recovery/privacy/custody assurance after all rules. Add quick types/lint, concise failure-preserving reporter, verbose mode, actual empty-execution guard, signal handling and focused verify name selection; compact canonical context/handoffs without mass moves. Tooling15, six negative CLI, named/empty source-bound smokes,206 doc links; same15-case278B vs2455B,2.35s vs2.36s no compute speedclaim. Native Advanced Ix/CHOAM47-card Stronghold profile: actual firstMentat/HMS/sixeffects,18native/four legalpolicies,five genuine2..6games3129actions/no rejection, human390px LAUDR2WNv14 bank2/personal1 plan and real battle. Earlier162/6513 checks before assurance amendment; finalquick25/build/guide pass. No new preservation/privacy audit or public/deployed/full-mode claim.
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { Readable } from 'node:stream';
|
|
import { spec, type TestEvent } from 'node:test/reporters';
|
|
|
|
// Keep Node's assertion diffs, locations, diagnostics, counts and duration output.
|
|
// Omitting starts as well as passes keeps the spec reporter's nesting stack valid.
|
|
export default async function* reporter(source: AsyncIterable<TestEvent>) {
|
|
async function* events(): AsyncGenerator<TestEvent> {
|
|
let executed = 0;
|
|
for await (const event of source) {
|
|
// Aggregate counters can include a synthetic pass for an empty test file.
|
|
// Worker summaries distinguish registered cases from that file-level result.
|
|
if (event.type === 'test:summary' && event.data.file !== undefined)
|
|
executed += event.data.counts.tests - event.data.counts.skipped;
|
|
if (
|
|
event.type === 'test:summary' &&
|
|
event.data.file === undefined &&
|
|
event.data.success &&
|
|
executed === 0
|
|
) {
|
|
// Node otherwise exits successfully when a name pattern matches no tests.
|
|
process.exitCode = 1;
|
|
yield {
|
|
type: 'test:diagnostic' as const,
|
|
data: {
|
|
nesting: 0,
|
|
level: 'error',
|
|
message: 'No tests executed. Check --name and skipped tests.',
|
|
},
|
|
};
|
|
}
|
|
if (
|
|
process.env.DUNE_TEST_VERBOSE !== '1' &&
|
|
(event.type === 'test:pass' || event.type === 'test:start')
|
|
)
|
|
continue;
|
|
yield event;
|
|
}
|
|
}
|
|
yield* Readable.from(events()).pipe(new spec());
|
|
}
|