-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit the number of statements in the output for t.true/t.false #1204
Comments
#1222 (comment) is another example of this. I can reproduce that using:
With AVA 0.18.1 we dump out each
Why did we remove the old formatter code? To get consistency in how we were displaying objects etc? Would it be an appropriate short-term fix to just show the last Longer term it might still be useful to show each |
Yeah, for consistency. Otherwise it'd be pretty weird to see completely different looking output for different assertions.
Totally agree. Perhaps we could even remove "statements" output for t.true/t.false until it's more production ready and just show actual/expected. What do you think?
Output would still be pretty long, not sure we'd want to show each property. I'd go for a proposal in #1205. |
Alternatively we could limit the depth to 1. |
Also a possibility, but I'm pretty sure it wouldn't solve the problem with the long output. |
👍 I think we should do that for now and work on improving the output before turning it on again. |
That doesn't leave us with much |
Yes, since "statements" output is the only thing using it. |
Some more examples from @davewasmer (#1278):
We should definitely filter out Node's built-in module, and the |
Just to weigh in here from #1278 - it seems like there's going to be suboptimal tradeoffs no matter what you do here. If you limit it to the last two members of a MemberExpression, that would still dump the entire I'll echo my suggestion in #1278 here - if the magic-assert info could be exposed in a machine readable way, that opens up the door to more userland experimentation with different reporter styles. But based on other issue threads, it sounds like userland reporters is something you intentional don't want to support - if that's the case, then feel free to disregard these comments 😉. For a bit of background / context: my motivation here is that Denali uses ava for running tests. If ava exposed more machine readable output, Denali could do some really interesting / cool things with that output since it knows much more about app than ava ever could. |
Despite my comment in #1278 (comment), really interesting features can always sway us :) |
This now needs concordancejs/concordance#12 to land. |
Does "properties" also mean return values from function calls? E.g. I have this line in my test: I don't know how much properties you want to log for each object in a test line, but probably it makes sense to count all the lines you logged already so you can check if this exceeds a limit. At the moment the statement above logs around 5 pages of screen space 😀 |
@hoschi, it does, yes.
The idea is to log a few properties for each object. It's pretty hard to find the correct trade-off though. |
With this you would make sure that "small" props (bool, date, string, ...) are rendered with an higher priority. With checking the rendered lines before recursing one level deeper, you know if you have already rendered a screen page of information and can stop here. This can be configurable to match font configs in IDEs/terminal. I hope it makes more sense now 😀 |
@hoschi yes thank you, that's a nice way of thinking about it. It's horribly complicated though! 😄 |
Note, this issue is related only to #1154.
Given this assertion:
AVA will output the value of each statement (
obj.a.b.c[0]
,obj.a.b.c
,obj.a.b
,obj.a
,obj
), which of course is not optimal, since the helpful values are probably only the last two. We should limit the number of statements to prevent a long list of unhelpful values.The text was updated successfully, but these errors were encountered: