During testing my new VueJS project with Jest I encountered problem caused by props validation.
All of my tests that has proper mocked data, pass the validator from component.
I would like to test situation when I mock wrong data and pass it to the component. I know that when the validator from component return false, vue.common.js console.error this:
console.error node_modules/vue/dist/vue.common.js:576
[Vue warn]: Invalid prop: custom validator check failed for prop "SOMETHING".
I would like to catch this error in my Jest test, but none of methods below I've tried work for me:
Using
spyOn(console, 'error')and thenexcept(spy.calls.mostRecent()).toHaveBeenCalled().Registering
console.*in globals like thisglobal.console {...}
I have no idea what should I try now or what I am doing wrong.
Thanks for the answers, cheers.