When mount the component, will error!
See original GitHub issueI found when I mount a component, it will render a commend node.But if I change the source of mount
function like this:
export function mount (component, options) {
if ( options === void 0 ) options = {};
if (!window) {
throwError('window is undefined, vue-test-utils needs to be run in a browser environment.\n You can run the tests in node using JSDOM');
}
var componentToMount = options.clone === false ? component : lodash.cloneDeep(component);
// Remove cached constructor
// delete componentToMount._Ctor;
var vm = createConstructor(componentToMount, options);
if (options.attachToDocument) {
vm.$mount(createElement());
} else {
vm.$mount();
}
return new VueWrapper(vm, { attachedToDocument: !!options.attachToDocument })
}
I remove the statement delete componentToMount._Ctor
, it will work!
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Error Boundaries - React
A class component becomes an error boundary if it defines either (or both) of the lifecycle methods static getDerivedStateFromError() or componentDidCatch() . ...
Read more >react error on componentDidMount -> Can only update a ...
The exact error message: Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, ...
Read more >Component error handling in React using Error Boundaries
In this tutorial, we will handle Component Error in React using Error Boundaries. Before React 16, errors emitted from a component's ...
Read more >React v16: Error during mount causes instance to ... - GitHub
When the component mounts it is added to the mountedInstances array but marked as pending . A 0ms timer with a callback to...
Read more >React Error Boundaries: Complete Guide - Meticulous
With the above setup, any error in the <Chat> component (or its descendant) would be caught in the Error Boundary wrapping the <Chat>...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Alendorff
https://github.com/vuejs/vue-test-utils/issues/329
Maybe u open a new issue?
@74sharlock sure, as you wish #1207
However issue like that looks a little excess for me, probably more general issue about documentation is needed.