TAP support#326
Conversation
There was a problem hiding this comment.
Need to remove this.
|
Looks very promising! :) 🍰
What specifically needs to be decided on? |
There was a problem hiding this comment.
Do we have to make assert a class? Can't we just track assertions here? Demanding the assert class track assertions is going to make it harder to support custom assertions down the road.
Is the issue simply that it is hard to know which argument is the message here?
There was a problem hiding this comment.
Do we have to make assert a class? Can't we just track assertions here?
I'm open to suggestions!
Demanding the assert class track assertions is going to make it harder to support custom assertions down the road.
It will, see my comment below.
Is the issue simply that it is hard to know which argument is the message here?
The issue lies in AVA's feature - concurrency. As you know, tests run concurrently, so we have to track which assertions happened during that particular test. That's why Assert class is needed, because that way we can safely get a list of test's assertions.
Sorry for not making that clear. We need to decide what title do we display for assertions: So, test have titles and assertion have titles too, so we need to decide on the latter. |
|
|
@vdemedes - I know I linked it before somewhere, but here are the docs you need for the FYI: @twada keeps stuff he still considers "beta" under his GitHub account and only moves stuff to the As for Finally, we are going to need to come up with a solution for assertions like this: t.same(foo, {
blah: 'blah',
bar: 'foo',
zippo: [1, 2, 3]
});That is probably a more than we want to log, even when compacted to a single line. We can probably do some pretty clever collapsing of the code eventually (i.e. For the first pass, maybe we don't use the |
|
For multiline assertions, power-assert normalizes the assertion lines to single line to render diagrams on reporting. For example, In @jamestalmage's case, |
Yes, my point was that even that will end up verbose given a large enough object declaration. I'm sure our eventual solution will share code with SuccinctReporter. |
There was a problem hiding this comment.
nitpick, but equal => strictEqual
|
@jamestalmage So I tried to use latest changes to assertions and turned out it's not actually usable for tracking assertions. I inserted { originalMessage: undefined,
enhanced: true,
args: [ true, undefined ],
assertionThrew: false,
returnValue: undefined }
The assertion is a simple |
|
I looked into this a bit. These will not attach a powerAssertContext: t.ok(true);
t.is('a', 'a');These will: var a = 'a';
t.ok(a);
t.is(a, 'a');
t.is({a: 'a'}.a, 'a');It should still be possible to build something close to the original source using |
I don't think this will have good consequences, we need a stable solution. Otherwise we'll end up with a babel-like stream of issues. |
|
Can we defer the assert title complications for later and focus on just getting some TAP output in this PR? We can just go for naive assert titles for now. |
👍 It's (no tap) the only thing that's preventing me from deep diving into Ava :) |
I agree. I think it will take us a while to figure that out correctly, and I don't want to hold up TAP support. Unfortunately, |
|
Ok, let's postpone it for now, I'll come up with something simpler. I'm off tomorrow, so I'll post updates the day after. @jamestalmage will take a look, thanks. |
|
Alright. I've opened an issue for it so we don't forget. #341 |
74673c1 to
736a044
Compare
|
PR updated with additions to Readme. Now it can be merged and we'll handle assertion output later. |
There was a problem hiding this comment.
Don't use bash as it's not valid shell script with the $.
There was a problem hiding this comment.
Was using it, because sometimes it highlights executable name and symbols like |. Will remove it, no probs ;)
There was a problem hiding this comment.
Yes, but the highlighting is very random.
There was a problem hiding this comment.
I think something like this would look nicer:
console.log([
'# ' + err.message,
format('not ok %d - %s', ++i, err.message),
' ---',
' name: ' + err.name,
' at: ' + getSourceFromStack(err.stack, 1),
' ...'
].join('\n'));|
Can you add some tests? |
|
And add |
There was a problem hiding this comment.
Would be more fun to illustrate with the nyan reporter, right? You also need to show installing the reporter. Otherwise we'll end up with support issues on how it doesn't work...
There was a problem hiding this comment.
Should we include a screenshot or that'd be too much?
There was a problem hiding this comment.
Actually, drop the install instruction. We can't know if they want to use it locally or globally. It has to be globally installed if used like the above, or locally if used in a npm run script.
I will! |
|
I'm thinking if we should return generated output from |
|
👍 |
7639370 to
cccb2cd
Compare
|
PR updated according to all suggestions:
|
|
LGTM |
⬆️ Can you open an issue for this? |
I'm surprised there's no compliance suite any TAP producer could use. Would be so useful (hint hint). Something like https://github.com/promises-aplus/promises-tests |
|
LGTM I have run it against a number of projects, and the output looks great when everything passes. Something feels off when there are errors though:
tail end of Neither tells you which test the failure came from (these are not uncaught exceptions, but assertion errors). |
|
We can improve the messages incrementally. |
I figured there's no need for this one, as we end the tests "safely". And not all reporters handle this stuff. @jamestalmage Try to use |
@sindresorhus good idea! |
cccb2cd to
d765dc2
Compare
|
@sindresorhus @jamestalmage guys, need you to LGTM one more time. It does not want to merge it otherwise. |
|
@sindresorhus @jamestalmage Never mind, merged! |





This PR fixes #27.
It adds
--tapflag to a CLI to generate TAP-compatible output, which can then be used with any 3rd-party reporters.Here are the things to be resolved before this PR can be merged:
test/assert.jsBail out!Let's discuss!