Expose the `wrapper` instance in the `render` method
elioschmutz opened this issue · 1 comments
elioschmutz commented
Hey
Would be great having access to the underlying wrapper-object to get access to the vue-test-utils methods and properties.
Here is the diff that solved my problem:
diff --git a/node_modules/@testing-library/vue/dist/render.js b/node_modules/@testing-library/vue/dist/render.js
index b55fc18..5599956 100644
--- a/node_modules/@testing-library/vue/dist/render.js
+++ b/node_modules/@testing-library/vue/dist/render.js
@@ -80,6 +80,7 @@ function render(Component) {
mountedWrappers.add(wrapper);
container.appendChild(wrapper.element);
return _objectSpread({
+ wrapper: wrapper,
container: container,
baseElement: baseElement,
debug: function debug() {This issue body was partially generated by patch-package.
afontcu commented
Hi! Thanks for opening the issue.
The question si quite similar to #250, and the answer too :) In short: Vue Testing Library is a wrapper on top of Vue Test Utils that hides methods that do not align to the principles of the testing library family. 99% of what you might need to test in a component is available in Vue Testing Library, and for that special 1% the recommendation is to use Vue Test Utils directly.
Hope it helps!