lib,test: fix error message check after V8 update

Backport-PR-URL: https://github.com/nodejs/node/pull/29241
PR-URL: https://github.com/nodejs/node/pull/28918
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Michaël Zasso committed 2019-09-19 08:48:17 +02:00
1 parent 027dcff207
commit 91d99ce41c
3 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -97,7 +97,7 @@ function enrichCJSError(err) {
usage. However, some cases are not matching, cases like import statement
after a comment block and/or after a variable definition.
*/
if (err.message.startsWith('Unexpected token export') ||
if (err.message.startsWith('Unexpected token \'export\'') ||
(/^\s*import(?=[ {'"*])\s*(?![ (])/).test(lineWithErr)) {
process.emitWarning(
'To load an ES module, set "type": "module" in the package.json or use ' +
+2 -2
View File
@@ -13,6 +13,6 @@ assert(vm.runInThisContext('%_IsSmi(43)'));
v8.setFlagsFromString('--noallow_natives_syntax');
assert.throws(function() { eval('%_IsSmi(44)'); },
/^SyntaxError: Unexpected token %$/);
/^SyntaxError: Unexpected token '%'$/);
assert.throws(function() { vm.runInThisContext('%_IsSmi(45)'); },
/^SyntaxError: Unexpected token %$/);
/^SyntaxError: Unexpected token '%'$/);
+1 -1
View File
@@ -152,7 +152,7 @@ const vm = require('vm');
);
}, {
type: SyntaxError,
message: 'Unexpected token }'
message: "Unexpected token '}'"
});
// Tests for failed argument validation