Skip to content

vm.runInContext() breaks delete on v18.2.0 #43129

Description

@alexlamsl

Version

v18.2.0

Platform

Microsoft Windows [Version 10.0.14393]

Subsystem

vm

What steps will reproduce the bug?

$ cat test.js
var a = "direct";
delete a;
console.log(a);

var vm = require('vm');

vm.runInThisContext(`
var b = "this";
delete b;
console.log(b);
`);

vm.runInContext(`
var c = "new";
delete c;
console.log(c);
`, vm.createContext({ console: console }));

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

$ node -v
v4.9.1
v6.17.1
v8.17.0
v10.24.1
v12.22.12
v14.19.1
v16.14.2
v18.0.0

$ cat test.js | node
direct
this
new

What do you see instead?

$ node -v
v18.2.0

$ cat test.js | node
direct
this
undefined

Additional information

No response

Activity

  1. dnalborczyk commented on May 17, 2022

    @dnalborczyk
    Contributor

    introduced by: #42963

    related: #42962

  2. added
    vmIssues and PRs related to the vm subsystem.
    on May 18, 2022
  3. alexlamsl commented on Aug 26, 2022

    @alexlamsl
    Author

    Still reproducible on v18.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vmIssues and PRs related to the vm subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions