mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
test_runner: show replayed-from-attempt hint in spec reporter
Signed-off-by: Moshe Atlow <moshe@atlow.co.il> PR-URL: https://github.com/nodejs/node/pull/63429 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Aviv Keller <me@aviv.sh>
This commit is contained in:
1 parent
b1fa59cbb6
commit
a646c93254
2 files changed
+13
-3
No files matched your search
@@ -73,7 +73,10 @@ function formatTestReport(type, data, showErrorDetails = true, prefix = '', inde
|
||||
let symbol = reporterUnicodeSymbolMap[type] ?? ' ';
|
||||
const { skip, todo, expectFailure } = data;
|
||||
const duration_ms = data.details?.duration_ms ? ` ${colors.gray}(${data.details.duration_ms}ms)${colors.white}` : '';
|
||||
let title = `${data.name}${duration_ms}`;
|
||||
const replayed = data.details?.passed_on_attempt !== undefined ?
|
||||
` ${colors.gray}(passed on attempt ${data.details.passed_on_attempt})${colors.white}` :
|
||||
'';
|
||||
let title = `${data.name}${duration_ms}${replayed}`;
|
||||
|
||||
if (skip !== undefined) {
|
||||
title += ` # ${typeof skip === 'string' && skip.length ? skip : 'SKIP'}`;
|
||||
|
||||
@@ -157,8 +157,15 @@ test('rerun preserves the original duration on the replayed pass', async () => {
|
||||
const durationFixture = fixtures.path('test-runner', 'rerun-duration.js');
|
||||
const args = ['--test-rerun-failures', stateFile, durationFixture];
|
||||
|
||||
await common.spawnPromisified(process.execPath, args);
|
||||
await common.spawnPromisified(process.execPath, args);
|
||||
const first = await common.spawnPromisified(process.execPath, args);
|
||||
assert.doesNotMatch(first.stdout, /passed on attempt/,
|
||||
'no replay marker should appear on the initial run');
|
||||
|
||||
const second = await common.spawnPromisified(process.execPath, args);
|
||||
assert.match(second.stdout, /passing slow test[^\n]*\(passed on attempt 0\)/,
|
||||
'spec reporter should mark the replayed test on the retry');
|
||||
assert.doesNotMatch(second.stdout, /always failing[^\n]*\(passed on attempt/,
|
||||
'the failing test must not show the replay marker');
|
||||
|
||||
const raw = JSON.parse(await readFile(stateFile, 'utf8'));
|
||||
const passKey = Object.keys(raw[0]).find((k) => raw[0][k].name === 'passing slow test');
|
||||
|
||||
Reference in new issue
Block a user