Skip to content

Commit

Permalink
3513684: JSON.parse errors made user-friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
jkleinsc authored and codebytere committed May 31, 2022
1 parent 77ac92d commit b1e4218
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions patches/node/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ fix_preserve_proper_method_names_as-is_in_error_stack.patch
macos_avoid_posix_spawnp_cwd_bug_3597.patch
src_update_importmoduledynamically.patch
fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch
json_parse_errors_made_user-friendly.patch
39 changes: 39 additions & 0 deletions patches/node/json_parse_errors_made_user-friendly.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <jkleinsc@electronjs.org>
Date: Thu, 26 May 2022 17:08:33 -0400
Subject: JSON.parse errors made user-friendly

Update tests for https://chromium-review.googlesource.com/c/v8/v8/+/3513684

diff --git a/test/es-module/test-esm-data-urls.js b/test/es-module/test-esm-data-urls.js
index 9d0deb70a1568c93ccdecbef59327ecb2a17ae5e..2ab8f2bdcf7cca1437df33668c4177a76b4dc3ca 100644
--- a/test/es-module/test-esm-data-urls.js
+++ b/test/es-module/test-esm-data-urls.js
@@ -75,7 +75,7 @@ function createBase64URL(mime, body) {
import('data:application/json;foo="test,",0',
{ assert: { type: 'json' } }), {
name: 'SyntaxError',
- message: /Unexpected end of JSON input/
+ message: 'data:application/json;foo="test,",0: Unterminated string in JSON at position 3'
});
}
{
diff --git a/test/es-module/test-esm-invalid-pjson.js b/test/es-module/test-esm-invalid-pjson.js
index cdbebb17b4bb34421a2f98c384650d495908885c..12247f15dbaddc0e06f1e6aff09faf7a035cf43a 100644
--- a/test/es-module/test-esm-invalid-pjson.js
+++ b/test/es-module/test-esm-invalid-pjson.js
@@ -17,11 +17,13 @@ child.stderr.on('data', (data) => {
child.on('close', mustCall((code, signal) => {
strictEqual(code, 1);
strictEqual(signal, null);
+ console.log('STDERR is: ', stderr);
+ console.log('DONE STDERR');
ok(
stderr.includes(
`[ERR_INVALID_PACKAGE_CONFIG]: Invalid package config ${invalidJson} ` +
`while importing "invalid-pjson" from ${entry}. ` +
- `Unexpected token } in JSON at position ${12 + checkoutEOL.length * 2}`
+ `Expected ':' after property name in JSON at position ${12 + checkoutEOL.length * 2}`
),
stderr);
}));

0 comments on commit b1e4218

Please sign in to comment.