Replies: 2 comments 4 replies
-
Could you elaborate on your use of logs? Do you pepper them throughout in case a test starts to fail? Personally I use them for debugging and sporadically to output say paths to temporary files generated by the test, so I can inspect those if needed. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I recently used this snippet to only log information about a test if it fails, keeping the test output less noisy on successful runs: const actual = doSomething(input);
const assertions = await t.try(tt => {
tt.is(actual, expected);
});
if (!assertions.passed) {
t.log("input:", input);
} |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What you're trying to do
I am usually only interested in seeing logged items via t.log() if the test has failed (and i'm trying to debug/figure out why). I usually don't care about t.log for tests that pass, and find that it clutters up the test result output, making it harder to jump to and find the test results I do care about (the failing ones)
Why you can't use AVA for this
There does not seem to be an ava configuration parameter or any other means to conditionally t.log() on a test failure.
And maybe how you think AVA could handle this
Ideally there could be an argument added to the command line that is something like --displayLogOnlyOnFailedTests and/or a way to configure this in the "ava" section of package.json
Beta Was this translation helpful? Give feedback.
All reactions