You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a big fan of pnpm, and I wanted to use it with a project using karma as test runner and I noticed that karma was not compatible with pnpm.
I debugged my config and I found that:
When karma is loading plugins:
It try to guess the plugin directory. It works by using the lib/plugin.js directory and go two directories up to retrieve the node_modules directory (here).
It works with npm (and probably with yarn too) because karma is usually installed inside the project node_modules directory.
Unfortunately, with pnpm, it does not work like this:
Karma is not directly installed in the project node_modules, it is installed in a .pnpm directory inside the project node_modules directory. The directory tree will look like this:
➡️ By going two directories up, the plugin directory is then [project]/.pnpm/[email protected]/node_modules, so obviously no plugins will be detected.
A (probably very naive) fix would to use process.cwd() instead of __dirname of karma/lib/plugin.js, this way you would get the project root directory. But, as said, it's probably very naive, and I'm sure I probably miss a lot of use cases.
In any case, I'd be happy to submit PR to fix this issue if you think it's worth it.
The text was updated successfully, but these errors were encountered:
Hi everyone,
I'm a big fan of pnpm, and I wanted to use it with a project using karma as test runner and I noticed that karma was not compatible with pnpm.
I debugged my config and I found that:
lib/plugin.js
directory and go two directories up to retrieve thenode_modules
directory (here).node_modules
, it is installed in a.pnpm
directory inside the projectnode_modules
directory. The directory tree will look like this:➡️ By going two directories up, the plugin directory is then
[project]/.pnpm/[email protected]/node_modules
, so obviously no plugins will be detected.A (probably very naive) fix would to use
process.cwd()
instead of__dirname
ofkarma/lib/plugin.js
, this way you would get the project root directory. But, as said, it's probably very naive, and I'm sure I probably miss a lot of use cases.In any case, I'd be happy to submit PR to fix this issue if you think it's worth it.
The text was updated successfully, but these errors were encountered: