nathanboktae / mocha-casperjs

Write CasperJS tests using Mocha
MIT License
120 stars 29 forks source link

Installation description #15

Closed marcusoftnet closed 10 years ago

marcusoftnet commented 10 years ago

Hi,

I had a hard time following the installation instructions. Probably because CasperJS wasn't installed (which in turn was hard to understand ... #yakshaving #recursive :)).

So i would love something like So if you haven't installed capserjs, do that first.

npm install -g casperjs

or if it's better (as it seem) to do the installation via brew.

brew update && brew install casperjs
npm install -g casperjs

Or at least a link to the installation and a mention that you need CasperJs installed. I was under the impression that your framework pulled it in. :s

nathanboktae commented 10 years ago

I was under the impression that your framework pulled it in. :s

That's totally a bug. Casper needs to be a peerDependency like mocha is. Let me fix that here soon.

This will also allow using bin/mocha-casperjs locally. I am using a local install of mocha-casperjs for my stuff at work and I was thinking to myself "Gee this command line sure is long". /facepalm Thanks for mentioning it.

Though I did debate about making it a direct dependency or a peer dependency. With peer, you can also use casperjs directly for global installs and mocha-casperjs, but it forces you to have a version that it satisfies globally, which is currently the latest build 1.1.0-beta3 (honestly it probably needs the latest from master - that npm package is 4 months old now and I think it has a bug fix or 2 in that aggrivates mocha-casperjs). I had it has a peer dependency because you can programatically require('mocha-phantomjs') directly to set it up just like a plugin to chai, grunt, or the likes, but I think no one really uses it, and having all your dependencies locally under node_modules is more in the spirit of npm in general.

What's your opinion? Should mocha and casperjs be peer dependencies or direct dependencies?

marcusoftnet commented 10 years ago

Yeah, I like having everything that I need to run "it", come down with npm install. So i vote to pull stuff into the node_modules folder. If I bring a site down using other frameworks I think you should just go "npm install" and then run it.

I'm not that well acquainted with everything node but couldn't you have global installs as well as directory local ones? So I can choose to run with the local installation in my node_module or with the "npm install -g XXX" version?

Well, any case: put it as dependencies locally.

Great work!

nathanboktae commented 10 years ago

I'm going to keep with a peer dependency for now. Two reasons:

  1. chai and casper-chai are optional modules that mocha-casperjs will look for as plugins, so keeping all these modules on the same level is nice for consistency.
  2. Talking with Nicolas, the creator of CasperJS, he'd like to see the testing frameworks as plugins, and I would too, so peer dependencies are aligned with that goal.

Though it was close, and I still think direct dependencies would be ok too.

marcusoftnet commented 10 years ago

It works fine now. As in npm install mocha-casperjs and then run the examples and "it just works"

Great work man!