-
Notifications
You must be signed in to change notification settings - Fork 262
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
fix: allow finding async component stubs by definition #2040
Conversation
✅ Deploy Preview for vue-test-utils-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
@@ -230,7 +243,8 @@ export function createStubComponentsTransformer({ | |||
return ( | |||
config.plugins.createStubs?.({ | |||
name: stubName, | |||
component: type | |||
component: type, | |||
registerStub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to provide an ability to mess with stubs (including async componentS) to the plugin system, so our plugins will be as capable as original createStub
A bit of off-topic: happy to be back to active development here! We have a Vue.js 3 migration working group established in GitLab, so I will be happy to dedicate more time polishing things here and adding new cool features |
ba8bbb3
to
0546844
Compare
0546844
to
15fb751
Compare
const AsyncComponentWithoutName = defineAsyncComponent(async () => ({ | ||
template: '<span>AsyncComponent</span>' | ||
})) | ||
|
||
it('stubs async component with name', async () => { | ||
const AsyncComponent = defineAsyncComponent(async () => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to move component definition inside test, because otherwise for second test __asyncResolved
will be already defined from previous test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Will give a bit of time for other reviewers to chime in, but tests look good.
This MR introduces an ability to find async component stubs by definition of underlying component, not just by wrapper itself
It also mimics
@vue/test-utils@1.x
behavior (well, kinda) -@vue/test-utils@1.x
was unable to stub async components due to limitations in our patch approach, so "finding" always worked cause there were no stubs