Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object.getOwnPropertySymbols not returning all symbols when using vm #47717

Closed
dubzzz opened this issue Apr 25, 2023 · 0 comments · Fixed by #47572
Closed

Object.getOwnPropertySymbols not returning all symbols when using vm #47717

dubzzz opened this issue Apr 25, 2023 · 0 comments · Fixed by #47572
Labels
vm Issues and PRs related to the vm subsystem.

Comments

@dubzzz
Copy link
Contributor

dubzzz commented Apr 25, 2023

Version

18.16.0

Platform

Linux codespaces-261118 5.4.0-1105-azure #111~18.04.1-Ubuntu SMP Fri Mar 3 22:47:43 UTC 2023 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Here is a repro:

// Arrange
const assert = require("assert");
const vm = require("vm");
const global = vm.runInContext("this", vm.createContext());
const totoSymbol = Symbol.for("toto");
const titiSymbol = Symbol.for("titi");

// Act
Object.defineProperty(global, totoSymbol, {
  enumerable: true,
  writable: true,
  value: 4,
  configurable: true,
});
global[titiSymbol] = 4;

// Assert
assert(Object.getOwnPropertySymbols(global).includes(totoSymbol)); // fails with: >=18.2.0 <18.16.0, >=19.0.0 <19.7.0
assert(Object.getOwnPropertySymbols(global).includes(titiSymbol)); // fails with: 18.x, 19.x

Related to jestjs/jest#13338

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

Always.

What is the expected behavior? Why is that the expected behavior?

Both asserts should pass. As they used to in v16.

What do you see instead?

One of the assert is still failing with the last releases of node 18 and 19. The other one has been fixed.

Additional information

A PR fixing the issue has already been opened: #47572

@VoltrexKeyva VoltrexKeyva added the vm Issues and PRs related to the vm subsystem. label Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants