tapjs / tap-parser

parse the test anything protocol
121 stars 35 forks source link

Emit values even if they're 0 #40

Closed Jameskmonger closed 7 years ago

Jameskmonger commented 8 years ago

I think we should emit fail, todo and skip on complete all the time, even if they're falsy.

That way it's easier to consume the event because you don't need to check for undefined when consuming it. It also makes the object schema a bit more consistent.

What do you guys think? @isaacs @sindresorhus @ljharb

isaacs commented 8 years ago

Seems reasonable to me. I think the only reason they're emitted is to reduce noise when they're output in yaml by harnesses. But that'd usually only happen on failure, so it's fine.

Jameskmonger commented 8 years ago

Great @isaacs

Would be a lot easier if I could do this:

parser.on("complete", results => {
    let totals = {
        pass: results.pass,
        fail: results.fail,
        skip: results.skip + results.todo
    };
});

Rather than:

parser.on("complete", results => {
    let totals = {
        pass: results.pass,
        fail: results.fail || 0,
        skip: (results.skip || 0) + (results.todo || 0)
    };
});
isaacs commented 8 years ago

Agreed! Patch welcome. Should be pretty straightforward.

Jameskmonger commented 7 years ago

@isaacs this has been submitted for PR in #44

Jameskmonger commented 7 years ago

Closed by #44, thanks @isaacs