pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: https://github.com/nodejs/node/commit/6e1beda333

ithubassets.com/assets/code-bedb41adf21fe337.css" /> test_runner: print info when test restarts · nodejs/node@6e1beda · GitHub
Skip to content

Commit 6e1beda

Browse files
Xstoudiaduh95
authored andcommitted
test_runner: print info when test restarts
When using spec reporter and running test in watch mode, print an info message containing the current datetime when tests restart. Fixes: #57206 PR-URL: #61160 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent f5803cc commit 6e1beda

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

lib/internal/test_runner/reporter/spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const {
55
ArrayPrototypePush,
66
ArrayPrototypeShift,
77
ArrayPrototypeUnshift,
8+
Date,
9+
DatePrototypeToLocaleString,
810
} = primordials;
911
const assert = require('assert');
1012
const Transform = require('internal/streams/transform');
@@ -101,6 +103,9 @@ class SpecReporter extends Transform {
101103
if (data.file === undefined) {
102104
return this.#formatFailedTestResults();
103105
}
106+
break;
107+
case 'test:watch:restarted':
108+
return `\nRestarted at ${DatePrototypeToLocaleString(new Date())}\n`;
104109
}
105110
}
106111
_transform({ type, data }, encoding, callback) {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import '../common/index.mjs';
2+
import { spec as SpecReporter } from 'node:test/reporters';
3+
import assert from 'node:assert';
4+
5+
const reporter = new SpecReporter();
6+
let output = '';
7+
8+
reporter.on('data', (chunk) => {
9+
output += chunk;
10+
});
11+
12+
reporter.write({
13+
type: 'test:watch:restarted',
14+
});
15+
16+
reporter.end();
17+
18+
assert.match(output, /Restarted at .+/);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy