-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Labels
Description
Hey !
Actually the library is not able to serialize Vue 3 component, even when embed in a VueWrapper (from @vue/test-utils, right ?).
The trick I used to "extract" the template from the Vue 3 wrapper :
import {shallowMount} from "@vue/test-utils";
import MyComp from "../MyComp.vue";
describe("Vue 3 component", () => {
it("should test with a snapshot", () => {
const component = shallowMount(MyComp, {});
expect(component.__app._container).toMatchSnapshot();
});
});By doing this trick, I actually have a readable snapshot :
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Vue 3 component should test with a snapshot 1`] = `
<div
data-v-app=""
>
<div
class="container"
>
<h2>
Weeeew, this is my comp !
</h2>
</div>
</div>
`;
If I don't use this trick, the whole VueWrapper instance is serialized as an object, with all properties and methods.
maurer2, ShGKme, Mararok, visualjerk, fyapy and 2 more