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

1.5.1 TypeError: WeakMap key null must be an object or an unregistered symbol #5617

Closed
6 tasks done
pheidt opened this issue Apr 25, 2024 · 1 comment
Closed
6 tasks done

Comments

@pheidt
Copy link

pheidt commented Apr 25, 2024

Describe the bug

In version 1.5.1, passing an object with null or undefined properties to toMatchObjectContaining causes a type error. The same code works as expected in version 1.5.0.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-atxdxf?file=test%2Fbasic.test.ts

test('breaks in 1.5.1', () => {
  expect({ a: null, b: 'b' }).toMatchObject({ a: null });
});

test('still works in 1.5.1', () => {
  expect({ a: null, b: 'b' }).toEqual(expect.objectContaining({ a: null }));
});

System Info

System:
    OS: macOS 14.4.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 311.91 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v20.12.2/bin/yarn
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
    pnpm: 8.10.0 - ~/.nvm/versions/node/v20.12.2/bin/pnpm
    bun: 1.0.29 - /opt/homebrew/bin/bun
  Browsers:
    Brave Browser: 124.1.65.114
    Chrome: 124.0.6367.80
    Edge: 124.0.2478.51
    Safari: 17.4.1

Used Package Manager

yarn

Validations

@hi-ogawa
Copy link
Contributor

Thanks for the report. The fix has been already merged but not released yet #5613

@github-actions github-actions bot locked and limited conversation to collaborators May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants