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

#1197 seems to improperly handle static method in prototype #1284

Closed
6 tasks done
calvin-sketchsoft opened this issue May 10, 2022 · 0 comments · Fixed by #1287
Closed
6 tasks done

#1197 seems to improperly handle static method in prototype #1284

calvin-sketchsoft opened this issue May 10, 2022 · 0 comments · Fixed by #1287

Comments

@calvin-sketchsoft
Copy link

calvin-sketchsoft commented May 10, 2022

Describe the bug

After #1197, Any failed test which contains bson.ObjectId does not display message properly.

 FAIL  test/basic.test.ts [ test/basic.test.ts ]
TypeError: Cannot assign to read only property 'generate' of object '[object Object]'

I tried to attach debugger and found out error obove occurs while creating message to display. clone() tries to copy static method, ObjectId.prototype.generate(), from val and fails to paste it on out.

out[k] = (tmp = (val as any)[k]) && typeof tmp === 'object' ? clone(tmp) : tmp

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-xnu5kw?file=test%2Fbasic.test.ts,package.json&initialPath=__vitest

System Info

System:
    OS: macOS 12.3.1
    CPU: (10) x64 Apple M1 Pro
    Memory: 25.07 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.18.1 - /usr/local/bin/node
    Yarn: 3.1.0 - /usr/local/bin/yarn
    npm: 8.1.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 101.0.4951.54
    Safari: 15.4
  npmPackages:
    vitest: ^0.12.0 => 0.12.0

Used Package Manager

yarn

Validations

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

Successfully merging a pull request may close this issue.

2 participants