With:
import test from 'ava';
test('returns true when happy', t => {
throw new Error('unicorn');
});
It currently outputs:
❯ ava
1 failed
returns true when happy
Error: unicorn
Test.fn (test.js:5:8)
I think we should simplify it to:
❯ ava
1 failed
returns true when happy
Error: unicorn
test.js:5:8
So users can quickly see where the error came from. Test.fn doesn't have any value to the user.
This also applies to the verbose reporter ($ ava --verbose).
We could also use https://github.com/sindresorhus/ansi-escapes#itermsetcwdpath to make the path clickable on iTerm.
I can take care of this as I've worked with the reporters before.
Hi, would you mind if i tackle this issue? However, when i run this test i get the following outout:
❯ ./cli.js ava.test.js
1 failed
returns true when happy
Error: unicorn
Test.t [as fn] (ava.test.js:4:11)
My outputTest.t [as fn] (ava.test.js:4:11) vs. sindresorhus output: Test.fn (test.js:5:8)
I'm using
❯ node -v
v7.1.0
Maybe the output from the errorstack has changed in node v7?
Responsible for the output:
Sure, no problem! Give it a try :D There must've been some changes in 7, I haven't looked yet.
Here's the Node 7 changelog.
@ntwcklng We always appreciate help, but @vdemedes is currently doing a big rewrite of the output, so this would conflict. I would ask you to wait until that work is done or try another issue :)
Okay thanks, i will have a look.
Hi there, is this still valid?
Only partly. The current output looks like:
❯ ava
1 failed
foo
test.js:24
23:
24: throw new Error('unicorn');
25: });
Error: unicorn
Test.fn (test.js:24:8)
As you can see, the test file and line are shown twice. I think we could simplify it to not show the stack trace if it's only the test function. @avajs/core Thoughts?
I think we could simplify it to not show the stack trace if it's only the test function. @avajs/core Thoughts?
👍
Simplify it to not show the stack trace if it's only the test function.
Can I take this as the issue?
@LasaleFamine Yes :)
I have a question. Is this related to reporters? The check should be made inside every reporters?
@LasaleFamine Yes, the mini and verbose reporter, but not tap.
Well, I need some ideas to a good and "self-explained" check. I will make a PR soon though I'm still in WIP.
Most helpful comment
Only partly. The current output looks like:
As you can see, the test file and line are shown twice. I think we could simplify it to not show the stack trace if it's only the test function. @avajs/core Thoughts?