Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Upn reviewing this, I was confused by the following code:
If my understanding of the TAP spec is correct, a plan like
1..4
represents 4 tests from test 1 to test 4. The above appears to have an off-by-one error where it stores4 - 1 = 3
, and the check ends as soon as length == 3, i.e. after test 3 instead of after test 4.I noticed there was no test case with a leading plan yet, and writing one, it appears to fail. It seems this is too obvious, so I'm probably am misunderstanding how this is supposed to work. In case this is a bug, here's what I found so far.
I added a
return;
to the test code where it writes the lastundefined
, but that made no difference (treated as ignored extra). Adding+1
toseen.plan
seems like the obvious fix, but produces a different error instead. I assumed that the reasonassert event 3
was never emitted by the parser is that afterevent 2
the stream is closed by callingp.end()
. However with the fix applied, the event still isn't emitted. It seems tap-parser doesn't want to emit it yet until the next test or a test plan appears. I added an empty line and a comment at the end but it still won't emit it.Debug diff