Skip to content

Commit

Permalink
Show test pass/fail with --console (#1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr authored Dec 19, 2023
1 parent 6002d22 commit d404683
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/dev/scripts/polkadot-exec-node-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import { run } from 'node:test';

// NOTE error should be defined as "Error", however the @types/node definitions doesn't include all
/** @typedef {{ details: { error: { failureType: unknown; cause: { code: number; message: string; stack: string; }; code: number; } }; file?: string; name: string }} FailStat */
/** @typedef {{ diag: { file?: string; message?: string; }[]; fail: FailStat[]; pass: unknown[]; skip: unknown[]; todo: unknown[]; total: number }} Stats */
/** @typedef {{ details: { duration_ms: number }; name: string; }} PassStat */
/** @typedef {{ diag: { file?: string; message?: string; }[]; fail: FailStat[]; pass: PassStat[]; skip: unknown[]; todo: unknown[]; total: number }} Stats */

console.time('\t elapsed :');

Expand Down Expand Up @@ -238,6 +239,20 @@ function complete () {
console.log();
}

if (toConsole) {
stats.pass.forEach((r) => {
console.log(`pass ${r.name} ${r.details.duration_ms} ms`);
});

console.log();

stats.fail.forEach((r) => {
console.log(`fail ${r.name}`);
});

console.log();
}

if (stats.total === 0) {
console.error('FATAL: No tests executed');
console.error();
Expand Down

0 comments on commit d404683

Please sign in to comment.