Skip to content

Commit

Permalink
fix: tap parser fails if a test logs a number
Browse files Browse the repository at this point in the history
  • Loading branch information
pulkit-30 committed Jan 2, 2023
1 parent a03529d commit 7db255e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/internal/test_runner/tap_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,18 @@ class TapParser extends Transform {
case TokenKind.TAP:
return this.#Version();
case TokenKind.NUMERIC:
return this.#Plan();
// Check for "Bail out!" literal (case insensitive)
if (
RegExpPrototypeExec(/^Bail\s+out!/i, this.#currentChunkAsString)
) {
return this.#Bailout();
} else if (this.#isYAMLBlock) {
return this.#YAMLBlock();
}
// Read token because error needs the last token details
this.#next(false);
this.#error('Expected a valid token');
break;
case TokenKind.TAP_TEST_OK:
case TokenKind.TAP_TEST_NOTOK:
return this.#TestPoint();
Expand Down

0 comments on commit 7db255e

Please sign in to comment.