vue-jest related: Cannot find module 'vue' from

113 views Asked by At

folder structure

As it shows in the picture, I have two projects that share some vue components.
I import ImageBlock.vue in my Card.vue component, it works fine. But when I write test cases for Card component, I got the error

> Cannot find module 'vue' from '../sharedComponents/ImageBlock.vue'

I searched, couldn't find any answers. How can I solve this?

1

There are 1 answers

1
Ibrahim On

I think the path from your test directory is wrong. If your test is in project2/test,

you should try importing from ../../sharedComponents/ImageBlock.vue