Search code examples
vue.jsjestjsvuejs3vue-clits-jest

Vue 3 CLI jest testing - MatchInlineSnapshot does not work?


I am having an issue with my Vue project where ToMatchInline Snapshot does not work and fails test Result of test

Any ideas?

Here's my config file Is also a typescript project

I also tried with render from @testing-library/vue and still getting the same... :(


Solution

  • As I was writing the question I figured it out. I needed a snapshot serializer:

    ran npm i -D jest-serializer-vue

    and added the following line to my jest.config.js

    snapshotSerializers: ["jest-serializer-vue"]

    so it now looks as so