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

Regression in v1.5.1: TypeError: Invalid value used as weak map key #5613

Closed
6 tasks done
ddolcimascolo opened this issue Apr 24, 2024 · 3 comments
Closed
6 tasks done

Comments

@ddolcimascolo
Copy link

Describe the bug

Lots of my tests now fail with

TypeError: Invalid value used as weak map key
    at WeakMap.set (<anonymous>)
    at file:///data/dev/cmdb/frontend/node_modules/@vitest/expect/dist/index.js:389:24
    at Array.every (<anonymous>)
    at file:///data/dev/cmdb/frontend/node_modules/@vitest/expect/dist/index.js:384:33
    at Object.subsetEquality (file:///data/dev/cmdb/frontend/node_modules/@vitest/expect/dist/index.js:399:37)
    at eq (file:///data/dev/cmdb/frontend/node_modules/@vitest/expect/dist/index.js:166:49)
    at equals (file:///data/dev/cmdb/frontend/node_modules/@vitest/expect/dist/index.js:129:10)
    at Proxy.<anonymous> (file:///data/dev/cmdb/frontend/node_modules/@vitest/expect/dist/index.js:931:18)
    at Proxy.<anonymous> (file:///data/dev/cmdb/frontend/node_modules/@vitest/expect/dist/index.js:797:17)
    at Proxy.methodWrapper (/data/dev/cmdb/frontend/node_modules/chai/lib/chai/utils/addMethod.js:57:25)

Reproduction

Not entirely sure, but I suspect a toMatchObject with an object with null keys. Like in expect(x).toMatchObject({ aNullKey: null })

System Info

System:
    OS: Linux 6.5 Linux Mint 21.3 (Virginia)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
    Memory: 2.26 GB / 15.34 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v20.9.0/bin/yarn
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
    pnpm: 8.12.1 - ~/.nvm/versions/node/v20.9.0/bin/pnpm
  Browsers:
    Chrome: 124.0.6367.60

Used Package Manager

npm

Validations

@ruicsh
Copy link

ruicsh commented Apr 24, 2024

yes, reproducible with objects with null values:

expect(actual).toMatchObject({ foo: null })

it works with 1.5.0, breaks with 1.5.1

@sheremet-va
Copy link
Member

Fixed in ce36845

@ddolcimascolo
Copy link
Author

Thx for fixing @sheremet-va. Will you release a new version soon, or deprecate v1.5.1? The problem seems quite severe to me...

@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

3 participants