`node:test` custom reporters get `test:stdout` and `test:stderr` events before `test:dequeue`
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
Version
v22.2.0
Platform
Linux 6a770f0f664c 6.6.26-linuxkit #1 SMP Sat Apr 27 04:13:19 UTC 2024 aarch64 GNU/Linux
Subsystem
test_runner
What steps will reproduce the bug?
Create a folder with these files:
index.test.mjs:
import { it } from "node:test";
it("test", () => {
console.log("message from the test");
});
reporter.mjs:
import util from "node:util";
export default async (source) => {
for await (const event of source) {
if (event.type === "test:stdout") {
console.log(event.type, util.inspect(event.data.message));
}
if (event.type === "test:dequeue") {
console.log(event.type, event.data.name);
}
}
};
and run
node --test --test-reporter=./reporter.mjs
which will print
test:dequeue index.test.mjs
test:stdout 'message from the test\n'
test:dequeue test
How often does it reproduce? Is there a required condition?
It always does the same
What is the expected behavior? Why is that the expected behavior?
I expected test:dequeue test to be printed before test:stdout 'message from the test\n' as the documentation states "Emitted when a test is dequeued, right before it is executed."
What do you see instead?
The test:stdout event is emitted before the test:dequeue, which makes it impossible to understand which test was running when the message was written to stdout.
Additional information
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Führe zunächst den gemeldeten Befehl mit index.test.mjs und reporter.mjs aus, um die Reihenfolge der Ereignisse zu reproduzieren. Lies die reporter-event-Behandlung von node:test test_runner und füge für diesen Fall Testabdeckung hinzu; abgeschlossen ist die Arbeit, wenn test:dequeue vor test:stdout für die Ausgabe dieses Tests beobachtbar ist und damit der dokumentierten Semantik entspricht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, node.js
- Bereich
- testing-qa
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 52/100