avajs / ava

Node.js test runner that lets you develop with confidence 🚀
MIT License
20.74k stars 1.41k forks source link

Show filename for test.todo(...) #1062

Closed mmkal closed 4 years ago

mmkal commented 8 years ago

Simple feature request... it'd be nice if the filename for a TODO test was shown (in the same way as it is for a failing test), so TAP parsers/IDEs can see them.

For example, with a Visual Studio Code task problem matcher, they could be flagged up as informational or warning problems. Then clicking on them in the "problems" view would take focus straight to the call to test.todo(...).

sindresorhus commented 8 years ago

Yeah, that would be useful for our Atom and Sublime plugins too. I think we could add some custom metadata to the TAP output, like filepath, line, column. Actually, we should really include that info for all tests.

ThomasBem commented 7 years ago

From what I have read about the TAP standard these additions we are talking about are outside of the specification, so we can call them and format them however we want?

So we could use your filepath, line and colum as a starting point, adding this to the output in both error and pass? https://github.com/avajs/ava/blob/master/lib/reporters/tap.js#L35:L51

Do we actually have access to that information when we are in the reporter though? As far as I know thats not in test.metadata or anything else?

sindresorhus commented 7 years ago

From what I have read about the TAP standard these additions we are talking about are outside of the specification, so we can call them and format them however we want?

Yes. They should be added as data in the YAML-block. There we are free to add whatever data we want.

So we could use your filepath, line and colum as a starting point, adding this to the output in both error and pass? https://github.com/avajs/ava/blob/master/lib/reporters/tap.js#L35:L51

👍

Do we actually have access to that information when we are in the reporter though? As far as I know thats not in test.metadata or anything else?

Only for errors currently, but would be useful to have it in the metadata.