Skip to content

Commit 486b96f

Browse files
committed
test: fix tap parser fails if a test logs a number
1 parent a03529d commit 486b96f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/internal/test_runner/tap_parser.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,18 @@ class TapParser extends Transform {
549549
case TokenKind.TAP:
550550
return this.#Version();
551551
case TokenKind.NUMERIC:
552-
return this.#Plan();
552+
// Check for "Bail out!" literal (case insensitive)
553+
if (
554+
RegExpPrototypeExec(/^Bail\s+out!/i, this.#currentChunkAsString)
555+
) {
556+
return this.#Bailout();
557+
} else if (this.#isYAMLBlock) {
558+
return this.#YAMLBlock();
559+
}
560+
// Read token because error needs the last token details
561+
this.#next(false);
562+
this.#error('Expected a valid token');
563+
break;
553564
case TokenKind.TAP_TEST_OK:
554565
case TokenKind.TAP_TEST_NOTOK:
555566
return this.#TestPoint();

0 commit comments

Comments
 (0)