1.0.3
https://codesandbox.io/s/naughty-hofstadter-qsycv?file=/src/components/HelloWorld.spec.js
Error in computed property would be thrown
Error in computed property wouldn't be thrown
This could be to do with the custom error handler. https://github.com/vuejs/vue-test-utils/blob/dev/packages/test-utils/src/error.js. Vue (or VTU) could be swallowing the error.
I have tried fixing this once before but no luck.
Related: https://github.com/vuejs/vue-test-utils/issues/1503
I actually do not think this is an issue with VTU, but instead Jest. I noticed in your code sandbox that an async function was passed into expect. This unfortunately doesn't work quite like most would expect it to behave. This issue as well as this stack overflow post should provide clarity.
In short, this will work:
try {
const wrapper = shallowMount(HelloWorld, {
propsData: {
color: "not-in-map"
}
});
await wrapper.vm.$nextTick();
}catch(e){
expect(e).toEqual(new Error(`Color not found: not-in-map`))
}
As well as a few other methods discussed here
I think you might be correct.
Might close this one, I don't think we can fix this in VTU; the above post should be a good enough work-around.
Works perfect, thx!