You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This prevents the ability to test error handling strategies for larger Vue projects that manage when errors occur in subcomponents and use fallback components.
To Reproduce
it('displays error messages from setup errors', async () => {
const theError = new Error('very bad things happened out of our control');
const ErrorSubComponent = defineComponent({
setup() {
throw theError;
},
template: '<div>I load external data from flaky provider</div>',
});
const ParentWithErrorSubComponent = defineComponent({
components: { ErrorSubComponent },
template: `
<div>
<h1>parent content</h1>
<ErrorHandlerSafeguard>
<ErrorSubComponent />
<div>inner content</div>
</ErrorHandlerSafeguard>
<footer>parent footer</footer>
</div>
`,
});
wrapper = mount(ParentWithErrorSubComponent, {...configWithErrorSafeguardPlugin}); // <--- throws
expect(wrapper.text()).toContain('parent content');
expect(wrapper.text()).toContain('parent footer');
expect(wrapper.text()).toContain('SAFEGUARD DEFAULT OOPS MESSAGE WITH DINOSAUR GAME');
expect(wrapper.text()).toContain('error details: very bad things happened out of our control');
expect(wrapper.text()).not.toContain('inner content');
expect(wrapper.text()).not.toContain('I load external data');
});
Expected behaviour
A wrapper is returned with the mounted component, or a configuration option added to mount to determine whether to intercept error handlers and throw errors, or return the wrapper.
Related information:
@vue/test-utils version: 2.2.2
Additional context
I'm happy to put a PR together to add this configuration option.
The text was updated successfully, but these errors were encountered:
Describe the bug
#1845 merged and released in v2.2.2 as a workaround for a reactivity issue with errors during mount in Vue. This causes errors during component mount to throw and not return a wrapper by intercepting the expected error handler.
This prevents the ability to test error handling strategies for larger Vue projects that manage when errors occur in subcomponents and use fallback components.
To Reproduce
Expected behaviour
A wrapper is returned with the mounted component, or a configuration option added to
mount
to determine whether to intercept error handlers and throw errors, or return the wrapper.Related information:
@vue/test-utils
version: 2.2.2Additional context
I'm happy to put a PR together to add this configuration option.
The text was updated successfully, but these errors were encountered: