-
Notifications
You must be signed in to change notification settings - Fork 111
Unable to make mocking or stubs #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
bug
Something isn't working
Comments
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? |
juancampuzano
added a commit
to juancampuzano/testing-library-docs
that referenced
this issue
Mar 14, 2023
Fixed the following issue: testing-library/vue-testing-library#291
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?The text was updated successfully, but these errors were encountered: