Testing console output
See original GitHub issueHello,
we’re in the process of migrating lint-staged to Listr2, but I have some question regarding test output assertion.
The orginal Listr’s verbose renderer printed [started]
and [completed]
strings, while Listr2 uses fancy symbols like ❯
and ✔
. These symbols are different on each platform, though, so testing in a CI environment is a bit difficult.
You can see the progress in the PR https://github.com/okonet/lint-staged/pull/852 and how the assertions fail on our Windows tests: https://ci.appveyor.com/project/okonet/lint-staged/builds/32413566/job/qyae7t039cckykre
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Unit Testing Console Output Made Easy - DZone
Capturing the console output and using that to assert isn't that hard in plain java. It is actually very easy but verbose. Most...
Read more >How To Test Console Log - DEV Community
In Jest, we have two ways to verify that console.log was called as we expect it to be. First, we can mock the...
Read more >How to test console output (console.log, console.warn) with ...
How to test console output (console.log, console.warn) with RTL (React-Testing-Library) and Jest · const originalWarn = console.warnafterEach(() => (console.
Read more >How to Write to Console in Unit Test in Visual Studio 2022
The easiest way to write output from the test is to use the Console.WriteLine method. [TestMethod] public void test_that_writes_to_console2() { Console.
Read more >Console output unit testing in the Kotlin application
Are you looking for a way to test your console output (println()) in your Kotlin project? In this post, I'm going to walk...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, seems to be just what we need! I’ll also use the test renderer when
TERM=dumb
just in case those don’t support the fancy glyphs.Something in the ballpark of this hopefully does it. I will also add tests here when I have free time but been lazy lately.
To call the test renderer set the renderer to test.
I will merge after I perform usual manual tests.