Skip to content
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

Simplify failure output #1072

Closed
sindresorhus opened this issue Oct 10, 2016 · 13 comments · Fixed by singapore/gl-got#13
Closed

Simplify failure output #1072

sindresorhus opened this issue Oct 10, 2016 · 13 comments · Fixed by singapore/gl-got#13

Comments

@sindresorhus
Copy link
Member

sindresorhus commented Oct 10, 2016

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.

@sotojuan
Copy link
Contributor

I can take care of this as I've worked with the reporters before.

@sotojuan sotojuan self-assigned this Oct 12, 2016
@ntwcklng
Copy link

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:

@sotojuan
Copy link
Contributor

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.

@sindresorhus
Copy link
Member Author

@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 :)

@ntwcklng
Copy link

ntwcklng commented Nov 18, 2016 via email

@sotojuan sotojuan removed their assignment Dec 20, 2016
@LasaleFamine
Copy link
Contributor

Hi there, is this still valid?

@sindresorhus
Copy link
Member Author

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?

@novemberborn
Copy link
Member

I think we could simplify it to not show the stack trace if it's only the test function. @avajs/core Thoughts?

👍

@LasaleFamine
Copy link
Contributor

Simplify it to not show the stack trace if it's only the test function.

Can I take this as the issue?

@sindresorhus
Copy link
Member Author

@LasaleFamine Yes :)

@LasaleFamine
Copy link
Contributor

I have a question. Is this related to reporters? The check should be made inside every reporters?

@sindresorhus
Copy link
Member Author

@LasaleFamine Yes, the mini and verbose reporter, but not tap.

@LasaleFamine
Copy link
Contributor

Well, I need some ideas to a good and "self-explained" check. I will make a PR soon though I'm still in WIP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants