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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request/Proposal: Flag for specifying plugin directories/plug n' play support #3498

Closed
njradford opened this issue May 6, 2020 · 2 comments

Comments

@njradford
Copy link

njradford commented May 6, 2020

I believe Plugn'Play in Yarn breaks this due to the relative path lookup from node_modules to obtain plugins. If I'm thinking about it correctly, this could be fixed with an option to specify explicitly how to obtain the plugin modules. Or a flag to turn off the relative import. If this sounds right/sense-making/useful I'd be happy to implement a PR.

@njradford njradford changed the title Flag for specifying plugin directories/plug n' play support Feature Request/Proposal: Flag for specifying plugin directories/plug n' play support May 6, 2020
@devoto13
Copy link
Collaborator

devoto13 commented May 7, 2020

I'm not sure that Karma can support plugins auto-loading with plug'n'play package manager. So you'll probably have to explicitly require and add all plugins to the config file, e.g.

plugins: [
  require('karma-chorme-launcher'),
  require('karma-jasmine')
]

Or is there a generic API, which allows to iterate through all available dependencies?

@njradford
Copy link
Author

I had no idea you could wire them up directly in that way. Thanks @devoto13.

devoto13 added a commit to devoto13/karma that referenced this issue Feb 6, 2021
Changes:

- Promote `require('karma-plugin')` form over `'karma-plugin'` form. Former makes it more clear that plugin is imported from an NPM package and it is a regular JS object, there is no magic behind it. This is inspired by karma-runner#3498 where user is not aware that it is even possible. This also should make it easier with plug'n'play package managers (like Yarn 2).
- Explain that `plugins` array does not activate plugins, but only registers them to clarify karma-runner#1247 (comment).
- Explain the plugin structure, DI and how to build a new plugin.
- Re-arrange "Developing plugins" page to make it easier to add more information about every plugin type. Adding actual information should be done in the separate PRs though.

Fixes karma-runner#1247
devoto13 added a commit to devoto13/karma that referenced this issue Feb 12, 2021
Changes:

- Promote `require('karma-plugin')` form over `'karma-plugin'` form. Former makes it more clear that plugin is imported from an NPM package and it is a regular JS object, there is no magic behind it. This is inspired by karma-runner#3498 where user is not aware that it is even possible. This also should make it easier with plug'n'play package managers (like Yarn 2).
- Explain that `plugins` array does not activate plugins, but only registers them to clarify karma-runner#1247 (comment).
- Explain the plugin structure, DI and how to build a new plugin.
- Re-arrange "Developing plugins" page to make it easier to add more information about every plugin type. Adding actual information should be done in the separate PRs though.

Fixes karma-runner#1247
johnjbarton pushed a commit that referenced this issue Feb 12, 2021
Changes:

- Promote `require('karma-plugin')` form over `'karma-plugin'` form. Former makes it more clear that plugin is imported from an NPM package and it is a regular JS object, there is no magic behind it. This is inspired by #3498 where user is not aware that it is even possible. This also should make it easier with plug'n'play package managers (like Yarn 2).
- Explain that `plugins` array does not activate plugins, but only registers them to clarify #1247 (comment).
- Explain the plugin structure, DI and how to build a new plugin.
- Re-arrange "Developing plugins" page to make it easier to add more information about every plugin type. Adding actual information should be done in the separate PRs though.

Fixes #1247
anthony-redFox pushed a commit to anthony-redFox/karma that referenced this issue May 16, 2023
Changes:

- Promote `require('karma-plugin')` form over `'karma-plugin'` form. Former makes it more clear that plugin is imported from an NPM package and it is a regular JS object, there is no magic behind it. This is inspired by karma-runner#3498 where user is not aware that it is even possible. This also should make it easier with plug'n'play package managers (like Yarn 2).
- Explain that `plugins` array does not activate plugins, but only registers them to clarify karma-runner#1247 (comment).
- Explain the plugin structure, DI and how to build a new plugin.
- Re-arrange "Developing plugins" page to make it easier to add more information about every plugin type. Adding actual information should be done in the separate PRs though.

Fixes karma-runner#1247
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

2 participants