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:
parent
c206e7490c
commit
5746769d68
@ -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 ' +
|
||||
|
@ -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 '%'$/);
|
||||
|
@ -152,7 +152,7 @@ const vm = require('vm');
|
||||
);
|
||||
}, {
|
||||
type: SyntaxError,
|
||||
message: 'Unexpected token }'
|
||||
message: "Unexpected token '}'"
|
||||
});
|
||||
|
||||
// Tests for failed argument validation
|
||||
|
Loading…
x
Reference in New Issue
Block a user