jest: [Bug]: Object.getOwnPropertySymbols() does not work against global instance with jest+node18
Version
27/28/29
Steps to reproduce
run the following test case:
it(‘Object.getOwnPropertySymbols does not work against global instance with jest+node18’, () => { const KEY = Symbol.for(‘key’);
expect(global[KEY]).toBe(undefined); expect(Object.getOwnPropertySymbols(global).includes(KEY)).toBe(false);
global[KEY] = ‘hello’;
expect(global[KEY]).toBe(‘hello’); expect(Object.getOwnPropertySymbols(global).includes(KEY)).toBe(true); });
Expected behavior
the test should pass
Actual behavior
the test passes with Node JS <16, fails starting with Node JS 18
Additional context
No response
Environment
System:
OS: macOS 12.5.1
CPU: (10) arm64 Apple M1 Max
Binaries:
Node: 18.10.0 - ~/.nvm/versions/node/v18.10.0/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v18.10.0/bin/npm
npmPackages:
jest: 28.1.3 => 28.1.3
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 33 (18 by maintainers)
Commits related to this issue
- 🐛(jest) Support failure to get timeout out of Jest The current code performs a work-around required as soon as the the user runs Jest with node 18.2.0 or above (whatever the version of Jest). As the... — committed to dubzzz/fast-check by dubzzz 2 years ago
- 🐛(jest) Support failure to get timeout out of Jest (#3519) * 🐛(jest) Support failure to get timeout out of Jest The current code performs a work-around required as soon as the the user runs Jest... — committed to dubzzz/fast-check by dubzzz 2 years ago
- vm: properly handle defining symbol props This PR is a follow-up of #46615. When bumping V8 for node 18, various bugs appeared around vm. Some have been fixed along the flow, but there is at least o... — committed to dubzzz/node by dubzzz a year ago
- vm: properly handle defining symbol props This PR is a follow-up of #46615. When bumping V8 for node 18, various bugs appeared around vm. Some have been fixed along the flow, but there is at least o... — committed to dubzzz/node by dubzzz a year ago
- vm: properly handle defining symbol props This PR is a follow-up of #46615. When bumping V8 for node 18, various bugs appeared around vm. Some have been fixed along the flow, but there is at least o... — committed to nodejs/node by dubzzz a year ago
- vm: properly handle defining symbol props This PR is a follow-up of #46615. When bumping V8 for node 18, various bugs appeared around vm. Some have been fixed along the flow, but there is at least o... — committed to nodejs/node by dubzzz a year ago
- vm: properly handle defining symbol props This PR is a follow-up of #46615. When bumping V8 for node 18, various bugs appeared around vm. Some have been fixed along the flow, but there is at least o... — committed to nodejs/node by dubzzz a year ago
- vm: properly handle defining symbol props This PR is a follow-up of #46615. When bumping V8 for node 18, various bugs appeared around vm. Some have been fixed along the flow, but there is at least o... — committed to MoLow/node by dubzzz a year ago
- vm: properly handle defining symbol props This PR is a follow-up of #46615. When bumping V8 for node 18, various bugs appeared around vm. Some have been fixed along the flow, but there is at least o... — committed to Ceres6/node by dubzzz a year ago
- vm: properly handle defining symbol props This PR is a follow-up of #46615. When bumping V8 for node 18, various bugs appeared around vm. Some have been fixed along the flow, but there is at least o... — committed to Ceres6/node by dubzzz a year ago
Fails on Node v18.16, but works as expected on Node v18.17.
@dubzzz, you fixed it! Thanks.
Let’s probably wait Node 19 release 🤔 I think it will come soon. At least I hope it will 😂
A fix should land soon in node 19. If no issue occurs, it will possibly be backported in node 18. More at https://github.com/nodejs/node/pull/46458
I just reported the very same issue on #13696. Definitely something strange going on 🤔 I tried to investigate a bit what can go wrong but so far no clue at all