Closed juancampuzano closed 1 year ago
I found the error in the documentation you haven't the stubs property inside the global property
import {render} from '@testing-library/vue'
import Component from './Component'
test('Can stub components', () => {
render(Component, {
global: { stubs: ['FontAwesomeIcon'] },
})
})
@juancampuzano Thanks! I was stuck on this for quite awhile because the documentation is incorrect.
nice catch! fancy to open up a PR in https://github.com/testing-library/testing-library-docs/blob/main/docs/vue-testing-library/faq.mdx fixing the issue?
If I can't use shallow rendering, how do I mock out components in tests?
In the documentation there is a way to mock a feature, but this is only working in the following library: @testing-library/jest-dom
In the example you will see that it is importing the
@testing-library/jest-dom
library on line #2 instead using@testing-library/vue
Do I need to install that library to make the mocking? Or Is there a way to do it in the
@testing-library/vue
library?