lib,test: fix error message check after V8 update

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 2019-06-17 10:00:31 +02:00
parent c206e7490c
commit 5746769d68
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600
3 changed files with 4 additions and 4 deletions

View File

@ -96,7 +96,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 ' +

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 '%'$/);

View File

@ -152,7 +152,7 @@ const vm = require('vm');
);
}, {
type: SyntaxError,
message: 'Unexpected token }'
message: "Unexpected token '}'"
});
// Tests for failed argument validation