Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/v8/src/parsing/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ void Parser::ParseWrapped(Isolate* isolate, ParseInfo* info,
FunctionLiteral* function_literal =
ParseFunctionLiteral(function_name, location, kSkipFunctionNameCheck,
FunctionKind::kNormalFunction, kNoSourcePosition,
FunctionSyntaxKind::kWrapped, LanguageMode::kSloppy,
FunctionSyntaxKind::kWrapped, info->language_mode(),
arguments_for_wrapped_function);

Statement* return_statement =
Expand Down
25 changes: 25 additions & 0 deletions test/parallel/test-cli-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ if (module !== require.main) {
const common = require('../common');
const assert = require('assert');
const child = require('child_process');
const fs = require('fs');
const path = require('path');
const fixtures = require('../common/fixtures');
const tmpdir = require('../common/tmpdir');

if (process.argv.length > 2) {
console.log(process.argv.slice(2).join(' '));
Expand Down Expand Up @@ -149,6 +151,29 @@ child.exec(...common.escapePOSIXShell`"${process.execPath}" --use-strict -p proc
assert.strictEqual(stderr, '');
}));

// Regression test for https://github.com/nodejs/node/issues/30039.
{
tmpdir.refresh();
const scriptPath = tmpdir.resolve('use-strict.js');
fs.writeFileSync(scriptPath, 'undeclared = 1;');

common.spawnPromisified(process.execPath, [scriptPath])
.then(common.mustCall(({ stdout, stderr, code, signal }) => {
assert.strictEqual(stdout, '');
assert.strictEqual(stderr, '');
assert.strictEqual(code, 0);
assert.strictEqual(signal, null);
}));

common.spawnPromisified(process.execPath, ['--use-strict', scriptPath])
.then(common.mustCall(({ stdout, stderr, code, signal }) => {
assert.strictEqual(stdout, '');
assert.match(stderr, /ReferenceError: undeclared is not defined/);
assert.strictEqual(code, 1);
assert.strictEqual(signal, null);
}));
}

// Regression test for https://github.com/nodejs/node/issues/3574.
{
const emptyFile = fixtures.path('empty.js');
Expand Down