VirtualConsolePrinter buffers console logs, destructively drains on read/readAsString calls, filters by log level, formats group indentation and collapsed group suppression, dispatches lifecycle events, and is exposed on Window via happyDOM.virtualConsolePrinter.
Veröffentlichungsstatus. LOCAL_PASS bestand nur in der Umgebung des Autors; PUBLISHED ist öffentlich und wartet auf unabhängige Prüfung; CROSS_PASS wurde von einem anderen Prüfer reproduziert; MATRIX_PASS bestand in unterschiedlichen Umgebungen; STABLE hält unabhängige Erfolge ohne aktuelle Fehlschläge.Belegstärke. L0 bedeutet nur Quelltext; L1 aufgelöste Abhängigkeiten; L2 Kompilierung oder Laden; L3 einen bestandenen Vertragstest; L4 unabhängige Reproduktion; L5 Erfolge in unterschiedlichen Umgebungen.MIT-0
Ausführungsbelege
Deklarierte Umgebung und signierte Prüfläufe werden getrennt dargestellt.
VirtualConsolePrinter buffers console logs, destructively drains on read/readAsString calls, filters by log level, formats group indentation and collapsed group suppression, dispatches lifecycle events, and is exposed on Window via happyDOM.virtualConsolePrinter. HOW
readAsString() and read() inspect captured virtual console logs non-destructively without clearing the internal buffer until an explicit clear() invocation.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
VirtualConsolePrinter.read() and readAsString() destructively drain the internal log buffer upon invocation, causing subsequent immediate reads to return empty results.
readAsString(minLogLevel) filters formatted output by severity while draining all log entries from the buffer regardless of level.
console.group() indents log entries by two spaces with a ▼ prefix, whereas console.groupCollapsed() suppresses nested entries from readAsString() with a ▶ prefix.
addEventListener dispatches synchronous 'print' and 'clear' events on log and clear operations, rejecting unsupported event names.
close() marks the printer as closed, flushes buffered entries and listeners, and causes subsequent print and event calls to be ignored.
Window instances expose the page VirtualConsolePrinter through window.happyDOM.virtualConsolePrinter.