Closed danielcompton closed 8 years ago
Hi @danielcompton, thanks for your work!
There a three things to consider before applying this change and from where I'm standing it wouldn't be desirable to do so:
package.json
).:paths {:karma "karma"}
if you get it globally than to know where to look for if you install Karma locally. Also, local is the default installation mode for npm
(no -g
required) which makes it even easier to get it wrong from doo
.As for a non standard node_modules
path, it can be configured in :paths {:karma "./some/other/node_modules/..."}
.
Hey @bensu
The main reason why I put this PR together is that I'm trying to roll out doo on our CLJS projects, but they need to be tested from Windows, as well as Mac OS X and Linux. When doo tries to run ./node_modules/karma/bin/karma start
, it won't run on Windows. They've also stopped shipping a karma.cmd
file in the main Karma project so on Windows you have to use karma-cli if you want to run Karma. See https://github.com/karma-runner/karma/issues/941#issuecomment-37329149 and Stack Overflow for more details.
If this PR isn't merged then we can provide a :paths {:karma "karma"}
manually on all of our projects to work around this. You might find others run into the same issue too.
On the linked page
The recommended approach is to install Karma (and all the plugins your project needs) locally in the project's directory.
and
you might find it useful to install karma-cli globally.
I think they should be a bit more explicit here, as Windows devs have to install karma-cli to use Karma.
0.1.7-SNAPSHOT
)As for a non standard node_modules path, it can be configured in :paths {:karma "./some/other/node_modules/..."}.
What I was thinking out loud about was how to handle this when you have Windows and Unix computers, as providing a path to "./some/other/node_modules/..."
won't work on Windows.
In summary:
I totally understand if you don't want to make a breaking change, and I definitely appreciate how nice it is to have all of your dependencies locally specified, without needing to install anything global. If you'd prefer, I can put together a different PR which advises people doing cross platform development to use karma-cli.
I also need to put together another PR after this to help doo
call Karma on Windows.
Great response, very clear where the pain points are. Let's address them:
npm install karma
no -g
needed) and it's easier to gt this right {:path {:karma "karma"}}
than this {:path {:karma "./node_modules/..."}}
I think it makes sense to be aligned with npm
s default installation mode.(.getPath (io/file ".node_modules" "karma" "bin" "karma'))
. This puts in evidence that the current implementation of :paths
is not suitable for a crossplatform team and that is now an issue in itself, #47.We should follow your suggestion: document the upstream issue and advice Windows and cross platform users to add :path {:karma "karma"}
and install karma-cli
. If you can add those docs great! Otherwise I'll get to it over the weekend and ask you for feedback since I'm not a Windows user myself.
Hopefully if somebody creates a karma.bat
, we will have #47 solved by then and allow your team to be cross platform and use a local config!
It is definitely recommend to use karma-cli.
:point_up: October 23, 2015 12:33 PM
OTOH
no specific recommendation, depends on your preference really https://github.com/karma-runner/karma/pull/1658#issuecomment-150376980
Following up on this, I got a really confusing error message on Windows when I ran doo without setting :paths {:karma "karma"}
. Even though I wrote the PR for Windows support, it took me a while to realise what was happening :)
'.' is not recognised as an internal or external command,
operable program or batch file.
I'd argue it would be better to encourage use of karma-cli
as the default installation method to ease confusion by others, and to get a consistent runner command for all environments. The test I was running above worked fine on unix, but failed on Windows. Docs would be another option, but is a little less preferable in my opinion.
Karma recommends that people install Karma locally, and install karma-cli globally to help them run Karma without having to call
./node_modules/karma/bin/karma start
, and to ease cross platform compatibility with Windows.This PR updates the documentation to recommend this installation approach, and changes the default Karma path from
./node_modules/...
tokarma
.One thing I'm not sure about is how to combine non-standard
node_modules
path (e.g. in subdirectories), withkarma-cli
. However I think that can be a secondary concern?