Skip to content

Commit 34be139

Browse files
committed
[INTERNAL] Invalid JSON: Fix unit tests for Node 19
Node 19 has a new error message for invalid JSON. Instead of "Unexpected token o in JSON at position 1" it now reads "Unexpected token 'o', "no json" is not valid JSON"
1 parent c186c97 commit 34be139

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/lib/lbt/bundle/Builder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ test.serial("writePreloadModule: with invalid json content", async (t) => {
5151
t.is(verboseLogStub.firstCall.args[0], "Failed to parse JSON file %s. Ignoring error, skipping compression.",
5252
"first verbose log argument 0 is correct");
5353
t.is(verboseLogStub.firstCall.args[1], "invalid.json", "first verbose log argument 1 is correct");
54-
t.deepEqual(verboseLogStub.secondCall.args[0], new SyntaxError("Unexpected token { in JSON at position 19"),
55-
"second verbose log");
54+
t.true(verboseLogStub.secondCall.args[0] instanceof SyntaxError, "second verbose log with SyntaxError");
55+
t.regex(verboseLogStub.secondCall.args[0].message, /JSON/, "second verbose log about incorrect JSON");
5656

5757
t.true(result, "result is true");
5858
t.is(writeStub.callCount, 1, "Writer is called once");

0 commit comments

Comments
 (0)