deno test printer feedback
#14156
Replies: 2 comments 1 reply
-
|
@bartlomieju has been looking into this. I am sure he will consider your feedback. |
Beta Was this translation helpful? Give feedback.
-
|
@jespertheend thanks for opening this. As pointed out by Kit this is something I discussed with the rest of the team and want to improve to bring it closer to other popular tools like vitest. The things I wanted to focus on in the first pass were:
In the second pass I want to use Thanks for the mockup, it's very useful. Feel free to open separate issues so we can discuss them more in depth. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been using deno as a test runner for some time now, and after having written about 900 tests, I've found a few issues with the way test results are printed. I'm not sure about any future plans for this, and I didn't want to create a separate ticket for every issue I had. So I figured I'd post something here first.
Finding the source of a failing test
When a test fails, the first thing you want to do is go to source code of the failing test in order to find out what exactly the test is about. Right now this is not very easy, you can do one of the following:
Possible solutions:
running n tests from file:///path/to/file.test.jswith a different color. That way when you scroll up you can immediately distinguish tests that come from one specific file.calculator.test.jswith test name"it adds two numbers together"and only the name is printed, it is not immediately clear that this test is fromcalculator.test.jsrather than another file that might have a similar test.It's hard to distinguish
console.log()calls from test resultsRight now if code calls
console.logthe result gets appended in between[test name] ...andokwithout any new lines, and multiple calls print double new lines in between every call.The same happens with
Check https://example.com/file.jsbeing printed when dynamically importing files.For instance, this test, which dynamically imports blob urls:

Though I reckon this would be pretty nontrivial, it seems logging code is already pretty scattered accross the codebase (see #13001).
Hiding test results if they don't fail
If I remember correctly, the test runner used by the Chrome DevTools team simply shows a progress bar of all the tests and only failing tests are reported. I believe they use Mocha.
In a way I like it because it's a lot easier to find failing tests, since you don't have to scroll through all the test results. And if you have a huge amount of tests, where one of the first ones fails, you won't have to wait for the entire suite to finish because the error would get printed right away.
But on the other hand I kind of like the verbosity that Deno has right now. Seeing a whole bunch of green ok's is pretty satisfying.
A quick mockup
Here's a quick mockup of what some of these changes could look like.
I think it's a lot easier to visually parse like this. Not sure how feasible it would be to print error messages in red though. Since error messages might have custom color formatting. Maybe they should only be printed in red if the error message does not contain any ansi codes.
Recap
Quick recap of all the changes:
console.log()calls in between the results (not shown in the mockup)Feel free to let me know if these changes are desirable (or if only a subset of them are), I'd be glad to create a new ticket for each of these.
Beta Was this translation helpful? Give feedback.
All reactions