Magic assert output is very noisy
See original GitHub issueFirst off, I just wanted to say the new magic-assert functionality is pretty awesome. It’s great to get some additional context from a test failure, and frequently saves me multiple rounds of “well, let’s try logging out this value”. And the designer in me appreciates the output formatting - very readable, scannable, and well structured.
That said, in many cases, the output can be very noisy in an unhelpful way. For example, I have several tests that assert that a file exists:
t.true(fs.existsSync(someFilePath), 'file exists');
In this case, magic-assert ends up printing the entirety of the fs
object, which is ~170 lines long, and not super helpful here. In another case, I assert a value on t.context:
t.true(fs.existsSync(t.context.someFilePath), 'file exists');
magic-assert dumps t
here, which ends up being nearly 800 lines long. This means lots of scrolling to find the info I actually care about (the value of t.context.someFilePath
).
Now, I realize the inherent difficulty (impossibility?) of determining what is “useful” to print out and what isn’t. One option that came to mind would be to have a browser based reporter, i.e. running ava would launch a browser tab that displayed the test results, which would allow for a richer UI for interacting with test results than is possible in the terminal. But based on other issue and PR comments, it seems like the ava team isn’t interested in supporting custom reporters other than via TAP, which loses the magic-assert info.
I don’t have any solid solutions to offer, and I normally refrain from posting issues like this when I can’t be constructive, but I figured I’d toss this out there in case someone smarter than I came along and had an idea. Feel free to close if this is just one of those inherently unsolvable issues.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
@novemberborn, thank you for the reply, and all the good work with ava. In some cases, I’m testing the REST endpoint, the response body is very big, so the terminal output gets exhausted, and I cannot even reach up to the start of the test output.
Also, I think giving both power-assert’s graphical output and magic-assert’s awesome 😃 output, and the options to disable one or the other would be very beneficial.
I know you’re working on improving magic assert, and I’m sure you have something better planned. Just thought I should mention my concerns & thought. Thanks again for job well done.
I understand, I’ll see if I can try your advice out then.