feat(report): console reporter with colours + TTY detection (#13) #32
No reviewers
Labels
No labels
area:assertions
area:cli
area:client
area:harness
area:meta
area:reporting
area:runner
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/ws-rpc-test!32
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/13-console-reporter"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #13. Stacked on #31.
Summary
Introduces
ConsoleReporter(insrc/report.rs) and wires it intoTestRunner::run(), replacing the inlineprintln!scaffolding from earlier tickets.Output (matches spec §5.1)
Colours
PASS, redFAIL, yellowSKIPvia thecoloredcrate.no_color: trueis passed toConsoleReporter::newNO_COLORenv var is set (per https://no-color.org)std::io::IsTerminal)colored::control::set_override(false).Failure rendering
TestError::Assertion→ full block with expected / got / context / locationTestError::Timeout→TIMEOUT waiting for <event> after <duration>TestError::RpcError→RPC ERROR <code>: <message>TestError::Connection→CONNECTION ERROR: <msg>Runner wire-up
RunConfig.no_color: bool+TestRunner::no_color(bool)setterrun()creates oneConsoleReporterand uses it for harness start, WebSocket connect, per-test lines, and the final summary. Both the sequential and parallel phases route through the same reporter.print_result/status_labelfrom #12 are deleted — the reporter owns that formatting now.Checklist (from issue #13)
Format
Starting... OK (X.Xs),Connecting to WebSocket... OK)PASS/FAIL/SKIPlines with timingColours
--no-colorandNO_COLORsupportFailure detail
TestError::Assertionfields + locationTimeout/RpcError/Connectionget appropriate blocksHeader
Test plan
src/report.rs(pass / fail / skip / summary / header)just qagreen locally — 94 unit + 5 integration = 99/99Notes for the reviewer
Reportertrait abstraction lands in #14 alongside the JSON and JUnit implementations. Extracting it now would mean one level of indirection for zero current benefit.harness_startedcaptures the startup duration viaInstant::now()inrun()just beforeharness.start().await, then calls the reporter after the harness is up. This matches the spec's "header includes harness startup time" requirement without needing to thread the duration through the harness API.verbosefield is present onConsoleReporterwith#[allow(dead_code)]; it's reserved for #15's-vflag (which will append stdout/stderr tail to failure blocks). Added now to avoid thrashing the struct in #15.Review — console reporter avec couleurs + TTY detection (#13)
TTY detection +
NO_COLORCorrect et conforme à la spec.
colored::control::set_override(false)est une mutation globale — ça fonctionne mais dans un processus multi-thread qui lance des tests en parallèle, deux reporters instanciés avec des settings différents se marcheraient dessus. Non-problème pour l'usage courant (un seul reporter par run).Bloc d'erreur structuré
Un
matchpar variant deTestErroravec des formats différents — correct. Chaque type d'erreur a son propre formatage (assertion block avec Expected/Got/Context, timeout, RPC error, connection error).Champ
verbose: boolmortRéservé pour usage futur, mais aucune logique n'utilise encore ce flag. À implémenter ou à supprimer — ne pas laisser en
allow(dead_code)dans le code final.Tests : pas de capture stdout
Les tests vérifient uniquement que les méthodes ne paniquent pas, pas le contenu du rendu. C'est acceptable pour une première implémentation, mais du snapshot testing (ou au moins une assertion sur une string capturée) renforcerait la confiance dans les formats de sortie.
Aucun bloquant.
✅ Pas de bloquant. Points à adresser avant release : champ
verbosemort (#[allow(dead_code)]), et tests sans assertion sur le contenu de la sortie.98b12110c2to81953fee00