Skip to content

[Bug]: Object.getOwnPropertySymbols() does not work against global instance with jest+node18 #13338

@le-cong

Description

@le-cong

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions