Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Allow to pass components and functions to hooks config #30576

Closed
pbrzosko opened this issue Apr 27, 2024 · 3 comments
Closed

[Feature]: Allow to pass components and functions to hooks config #30576

pbrzosko opened this issue Apr 27, 2024 · 3 comments

Comments

@pbrzosko
Copy link

馃殌 Feature Request

It is not possible to pass other things that primitive types and array or object of those types to HooksConfig as it extends JsonObject. It should be possible to pass anything there like components, functions and so on.

Example

export type HooksConfig = {
  routes: RouteRecordRaw[];
};

beforeMount<HooksConfig>(async ({ hooksConfig, app }) => {
  const routes = hooksConfig?.routes;
  if (routes) {
    const router = createRouter({
      history: createWebHashHistory(),
      routes,
    });
    app.use(router);
  }
});

Motivation

I would like to be able to pass router config through HooksConfig, so that I can create routing config as small as possible related to the test scenario I am checking.

@pbrzosko
Copy link
Author

I am discussing component testing here of course.

@sand4rt
Copy link
Collaborator

sand4rt commented Apr 27, 2024

related to: #30453

@dgozman
Copy link
Contributor

dgozman commented Apr 29, 2024

I'll close this as a duplicate of #30453.

@dgozman dgozman closed this as completed Apr 29, 2024
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

No branches or pull requests

3 participants