test-runner
test-runner copied to clipboard
[question] Error: Cannot find module 'detect-package-manager'
It seems that when running tests for a Storybook managed in a separate package, with a package.json that only includes @storybook/test-runner, concurrently, and wait-on as dependencies, an error occurs stating Error: Cannot find module 'detect-package-manager'.
I suspect this error is due to detect-package-manager being included in the devDependencies of @storybook/test-runner, rather than in its dependencies.
The version of @storybook/test-runner being used is 0.16.0.
I see the same thing with semver when using pnpx with hoisting turned off in .npmrc. Injecting a dep on semver then gives the detect-package-manager error described here. After injecting a dep on that too, it works.
So, in other words, this package is depending on npm's (and yarn 1's) default behavior of hoisting dependencies and needs either a deprendency or peerDependency on both semver and detect-package-manager.
I haven't tested, but with newer versions of yarn that have PnP enabled it probably fails similarly.
Hey everyone! In the most recent versions of the test-runner (0.18.0), neither semver nor detect-package-manager are used anymore, so this problem should go away. Please upgrade whenever you can! Thanks <3