electron/patches/node/json_parse_errors_made_user-friendly.patch
2022-06-01 08:12:47 +02:00

39 lines
1.7 KiB
Diff

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);
}));