GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test_runner: show replayed-from-attempt hint in spec reporter · nodejs/node@288c320

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/test_runner/reporter
    • utils.js
  • test/parallel
    • test-runner-test-rerun-failures.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/test_runner/reporter/utils.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/reporter/utils.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ function formatTestReport(type, data, showErrorDetails = true, prefix = '', inde
7373
let symbol = reporterUnicodeSymbolMap[type] ?? ' ';
7474
const { skip, todo, expectFailure } = data;
7575
const duration_ms = data.details?.duration_ms ? ` ${colors.gray}(${data.details.duration_ms}ms)${colors.white}` : '';
76-
let title = `${data.name}${duration_ms}`;
76+
const replayed = data.details?.passed_on_attempt !== undefined ?
77+
` ${colors.gray}(passed on attempt ${data.details.passed_on_attempt})${colors.white}` :
78+
'';
79+
let title = `${data.name}${duration_ms}${replayed}`;
7780

7881
if (skip !== undefined) {
7982
title += ` # ${typeof skip === 'string' && skip.length ? skip : 'SKIP'}`;
Collapse file

‎test/parallel/test-runner-test-rerun-failures.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-runner-test-rerun-failures.js
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,15 @@ test('rerun preserves the original duration on the replayed pass', async () => {
157157
const durationFixture = fixtures.path('test-runner', 'rerun-duration.js');
158158
const args = ['--test-rerun-failures', stateFile, durationFixture];
159159

160-
await common.spawnPromisified(process.execPath, args);
161-
await common.spawnPromisified(process.execPath, args);
160+
const first = await common.spawnPromisified(process.execPath, args);
161+
assert.doesNotMatch(first.stdout, /passed on attempt/,
162+
'no replay marker should appear on the initial run');
163+
164+
const second = await common.spawnPromisified(process.execPath, args);
165+
assert.match(second.stdout, /passing slow test[^\n]*\(passed on attempt 0\)/,
166+
'spec reporter should mark the replayed test on the retry');
167+
assert.doesNotMatch(second.stdout, /always failing[^\n]*\(passed on attempt/,
168+
'the failing test must not show the replay marker');
162169

163170
const raw = JSON.parse(await readFile(stateFile, 'utf8'));
164171
const passKey = Object.keys(raw[0]).find((k) => raw[0][k].name === 'passing slow test');

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.