Closed jh3141 closed 6 years ago
@jh3141 thanks for giving this plugin a try and the detailed description for the issue.
On macOS karma-cli is not installed as a package dependency when one installs karma. So path.join(root, 'node_modules', 'karma-cli', 'bin', 'karma')
does not exist. Is it different on win? Or does one need to explicitly install karma-cli?
@jh3141 fixed with 1.1.1 release. Thanks for reporting!
When you try to run tests on win32, the runner tries to execute the command
<node path> <project path>\node_modules\.bin\karma.cmd
.karma.cmd
is a windows batch file, not a JS script file, so this fails with the following error:This is apparently because, despite the fact that the
npm
documentation statesthis isn't actually true on win32; on win32 it creates a batch file that attempts to find an installed copy of node and use it to run the configured script.
A suggested resolution may be to change the
karmaBinary
property returned fromgetContext
topath.join(root, 'node_modules', 'karma-cli', 'bin', 'karma')
which ought to work correctly. This does depend on internal details of the organisation of the karma packages, though, so if you're feeling adventurous it might make more sense to try parsingkarma.cmd
to extract the correct filename to execute directly. For reference, in case you don't have a windows machine to test on, thekarma.cmd
file generated on my system is: