Skip to content

feat(ct): vue2 plugins#18596

Merged
pavelfeldman merged 2 commits intomicrosoft:mainfrom
sand4rt:ct-vue2-plugins
Dec 19, 2022
Merged

feat(ct): vue2 plugins#18596
pavelfeldman merged 2 commits intomicrosoft:mainfrom
sand4rt:ct-vue2-plugins

Conversation

@sand4rt
Copy link
Copy Markdown
Contributor

@sand4rt sand4rt commented Nov 6, 2022

There is no support for Vue2 plugins (probably because there was no test yet describing/documenting this behaviour) and did some minor refactoring.

@sand4rt sand4rt force-pushed the ct-vue2-plugins branch 2 times, most recently from f2276e7 to 0eeea66 Compare November 6, 2022 18:52
Comment thread packages/playwright-ct-vue2/hooks.d.ts Outdated
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
type JsonArray = JsonValue[];
type JsonObject = { [Key in string]?: JsonValue };
type VueOptions = ComponentOptions<Vue> & { router?: unknown, store?: unknown, [key: string]: unknown };
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we special-case router?: unknown, store?: unknown, [key: string]: unknown here?

Copy link
Copy Markdown
Contributor Author

@sand4rt sand4rt Nov 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to & Record<string, unknown> otherwise the type error below is thrown. This is also to support:

new Vue({
  test: 'test', // it is possible to pass any key when creating the Vue object
  router,
  render: h => h(App),
}).$mount('#app');
playwright/index.ts:10:26 - error TS2345: Argument of type '({ Vue, hooksConfig }: { hooksConfig: HooksConfig; Vue: VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<...>, never, never, ...>>>; }) => Promise<...>' is not assignable to parameter of type '(params: { hooksConfig: HooksConfig; Vue: VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<...>, never, never, ...>>>; }) => Promise<...>'.
  Type 'Promise<{ test: string; }>' is not assignable to type 'Promise<void | ComponentOptions<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>, ... 7 more ..., ComponentOptionsMixin>>'.
    Type '{ test: string; }' is not assignable to type 'void | ComponentOptions<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>, ... 7 more ..., ComponentOptionsMixin>'.

10 beforeMount<HooksConfig>(async ({ Vue, hooksConfig }) => {

Comment thread packages/playwright-ct-vue2/hooks.d.ts Outdated
@sand4rt sand4rt marked this pull request as draft November 9, 2022 17:01
@sand4rt sand4rt marked this pull request as ready for review November 9, 2022 17:13
@sand4rt sand4rt marked this pull request as draft November 9, 2022 18:59
@sand4rt sand4rt marked this pull request as ready for review November 11, 2022 13:40
@pastelsky
Copy link
Copy Markdown
Contributor

@sand4rt Looks like you have a failing build — might be a flake though. Do you mind re-running?

@sand4rt
Copy link
Copy Markdown
Contributor Author

sand4rt commented Dec 12, 2022

@pastelsky I don't think it is related to my changes, but sure

@pastelsky
Copy link
Copy Markdown
Contributor

I know — was probably flake. Just giving it a gentle nudge since this seems like a pre-req for #18616

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants