tapjs/tap-parser

Comments lost in results object

Closed this issue · 1 comments

Looking at how https://github.com/isaacs/node-tap/blob/master/lib/tap-producer.js works, it handles comments just fine when encoding. tap-parser however is lossy with respect to comments. For example, the lines # beep and # boop in the README example are lost.

Obviously it makes no sense to add comments to the asserts property, however, it would be nice to maybe have another array property that contains both the comments and asserts. All the items in this array are added to the asserts array or a new comments property array. And all the items in the asserts array continue to be added to pass, fail, todo

This approach does not change the existing API of the results object, so nothing relying on tap-parser results will break. Furthermore, it's important that this functionality get into the main project since relying on my own fork isn't an option, since i'm relying on wd-tap-parser, which relies on wd-tap, which relies on tap-finished, which gets its results from tap-parser.

I'm more than happy to open a pull request for this. Do you have any preference with respect to what this new array property is called that contains both the asserts and the comments?

As of v1, the results object contains less info, but there are events throughout so that you can easily listen and re-constitute in order now if you'd like.