We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
spy.on
I've noticed that if you do something like
const object = Object.create(null); object.method = function() {}; chai.spy.on(object, 'method');
it will throw an error because it uses
object.hasOwnProperty(methodName);
This can be fixed easily by changing it to
Object.hasOwnProperty.call(object, methodName);
I will file a PR for this.
I've encountered the issue in the context of migrating to Vue 3 and using @vue/test-utils. Apparently if you mount a component like
import { mount } from '@vue/test-utils'; let { vm } = mount(Component);
then vm is an object with null as its prototype. If you then want to spy on some of its methods with chai.spy.on, it throws the error above.
vm
null
chai.spy.on
The text was updated successfully, but these errors were encountered:
Fix chaijs#117: support spy.on with nullish prototype
3552392
Support spy.on with nullish prototype (#118)
419cddd
Fixes #117. Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
Successfully merging a pull request may close this issue.
I've noticed that if you do something like
it will throw an error because it uses
This can be fixed easily by changing it to
I will file a PR for this.
Context
I've encountered the issue in the context of migrating to Vue 3 and using @vue/test-utils. Apparently if you mount a component like
then
vm
is an object withnull
as its prototype. If you then want to spy on some of its methods withchai.spy.on
, it throws the error above.The text was updated successfully, but these errors were encountered: