Skip to content

Show line number of test declaration #867

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

Closed
jamestalmage opened this issue May 24, 2016 · 2 comments
Closed

Show line number of test declaration #867

jamestalmage opened this issue May 24, 2016 · 2 comments

Comments

@jamestalmage
Copy link
Contributor

jamestalmage commented May 24, 2016

import test from 'ava';

function macro(t, input, expected) {
    t.is(eval(input), expected);
}

test(macro, '2 + 2', 4);
test(macro, '2 + 3', 5);
test(macro, '2 + 4', 7);
   2 passed
   1 failed


   1. [anonymous]

  t.is(eval(input), expected)
       |    |       |        
       6    "2 + 4" 7        

      Test.macro (foo.js:4:4)

Ideally, we would show the declaration stacktrace as well (i.e. foo.js:9:1 in the above example).

@jamestalmage jamestalmage changed the title Failures in macros should show stacktrace Failures in macros should show declaration stacktrace May 24, 2016
@novemberborn
Copy link
Member

I don't think this is macro specific. Rather, we should show the relative file path and line on which a test was declared, perhaps in grey below the test title. So in the following:

screen shot 2017-08-28 at 16 07 58

foo would be followed by test.js line 3

@novemberborn novemberborn added question and removed enhancement new functionality help wanted labels Aug 28, 2017
@novemberborn
Copy link
Member

The test() function could obtain a stack trace to figure out the line number. Of course the test could be declared in a separate file, so perhaps it should find the first call site from the test file itself. We need to see what the performance implications are of doing this.

@novemberborn novemberborn changed the title Failures in macros should show declaration stacktrace Show line number of test declaration Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants