-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(ct): vue type safe mount props #23151
Conversation
5e8a5b3
to
f382eb9
Compare
component: any, | ||
options: MountOptions<HooksConfig, never> & { props: Props } | ||
): Promise<MountResult<Props>>; | ||
mount<HooksConfig extends JsonObject, Component = unknown>( |
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.
do you think this will break existing clients? or do we want to break them with these stricter types?
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.
do you think this will break existing clients?
A subset of existing clients using the Vue object API could see some type errors:
-
When the prop is manually passed to the
mount<_, Props>()
generic. -
When a required prop is missing or when a wrong prop type passed to the
mount()
. -
When a invalid prop or non existing type is passed to
component.update()
do we want to break them with these stricter types?
IMO yes. It is cumbersome to specify prop types manually.
When a wrong prop type is passed I think it would be good to know that immediately instead of running the test and checking if Vue logged anything to the console.
I think it's also useful to have autocompletion on both mount()
and component.update()
.
related to: testing-library/vue-testing-library#305 |
👋 @sand4rt what should we do with this one? |
f382eb9
to
5e1720d
Compare
Test results for "tests 1"2 interrupted 62 passed, 524 skipped Merge workflow run. |
Test results for "tests 1"1 failed 10 flaky 25022 passed, 583 skipped ❌ [playwright-test-macos-latest-node16] › reporter-html.spec.ts:1452:7 › created › labels › filter should update stats
Merge workflow run. |
I resolved the merge conflicts and comment. Would really like to see this merged. |
4b915b0
to
3f42ed6
Compare
Test results for "tests 1"6 flaky 25027 passed, 583 skipped Merge workflow run. |
partial fix for: #17206
https://www.npmjs.com/package/vue-component-type-helpers has been released last month and is maintained by Vue. It's also used in Vue Test Utils: https://github.com/vuejs/test-utils/blob/main/package.json#L26
related: #23194