question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Magic assert output is very noisy

See original GitHub issue

First 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
qaiser110commented, Feb 21, 2017

@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.

0reactions
brokensealcommented, Dec 19, 2018

I understand, I’ll see if I can try your advice out then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Quest for Lowering the Noise Floor | Headphone Reviews ...
Err. Here is how you control the noise: turn up volume on the source to the max, thus achieving highest SNR possible from...
Read more >
Advanced Argument Handling in Bash - assert_not magic?
We pass 4 -v options, so we're being extra verbose, as you see from the output. We change the default number of times...
Read more >
When should I use Debug.Assert()? - Stack Overflow
In Debugging Microsoft .NET 2.0 Applications John Robbins has a big section on assertions. His main points are: Assert liberally.
Read more >
Assertions (assert()) - mbedded.ninja
assert () is usually defined in C using a macro (rather than a function), due to the ability of automatically keep track of...
Read more >
Improving Block Code Distillation (Part 2)
What the block code circuit is really doing is computing the AND of ... we apply can be noisy, and that our output...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found