Repository navigation
feat(cli): coloured, live output for wasit test at a terminal - #35
Merged
Merged
Conversation
At a terminal, `wasit test` now shows its checks in Wasit's own look: a header, two blocks (challenge, payment), and one line per check with a mark and a badge that agree (PASS on green, FAIL on red, SKIP on yellow, ERROR on magenta) and its duration. A spinner line says what the check in flight is doing, and the verdict, the counts and the run's duration come at the end. On a network that is not a test network, the payment block says the checks are refused, never that funds move. A skip that gives the same reason as the skip above it does not repeat it. The colours are the site's and the dashboard's, exact on a terminal with 24-bit colour, and a badge's ink is given as exact black or white, since a terminal that draws bold text in bright colours turns bold black into grey. Every line is cut or wrapped to the terminal's width, so the spinner line never wraps and is always rewritten in place. `wasit mpp-charge` and `wasit mpp-channel` mark their results the same way. Colour is a layer over the same text: every line is sanitised and its secrets redacted before it is styled, so the only escape sequences on screen are Wasit's own. A pipe, CI, --json and NO_COLOR get the plain output exactly as before (compared over every kind of result), and FORCE_COLOR=1 colours a pipe without moving the cursor.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft, part of the pre-release
0.8.0-beta.1, stacked on #30. Do not merge before the pre-release.What it changes
At a terminal,
wasit testshows its run in Wasit's own look:wasit mpp-chargeandwasit mpp-channelmark their results the same way.The colours are the palette the site and the dashboard use: exact on a terminal with 24-bit colour, the nearest 256 or 16 colours otherwise. Badge ink is exact black or white, so a terminal that draws bold text in bright colours does not turn it grey.
What does not change
--jsonandNO_COLORget the plain output exactly as before. The old and the newreport()were compared over seven result sets, with and without a protocol, as text and as JSON: 28 of 28 identical, exit codes too.FORCE_COLOR=1colours a pipe without moving the cursor.Tests
packages/cli/test/unit/live-output.test.ts, 19 tests: colour detection, the layout, the spinner line at 30, 50, 80 and 200 columns, marks and badges, badge ink at every colour depth, sanitising and redaction, the plain path, and the built binary withFORCE_COLOR,NO_COLOR, CI, a pipe,--json, 256 colours andstellar:pubnet.wasit servein its misbehaving modes. Not run on Windows.