nathanboktae / mocha-casperjs

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

Not finding chai and casper-chai #44

Closed davidosomething closed 10 years ago

davidosomething commented 10 years ago

Here's the branch where it fails: https://github.com/davidosomething/glutton/tree/casper-chai-detect

Here's the grunt command:

grunt mocha_casperjs:all

The grunt config is https://github.com/davidosomething/glutton/blob/master/config/grunt/mocha-casperjs.coffee

I have to manually require chai, casper-chai:

chai = require('chai')
expect = chai.expect
casper_chai = require('casper-chai')
chai.use(casper_chai)

adding this to the top for my tests (in test/e2e/index.coffee) to work Tests: https://github.com/davidosomething/glutton/blob/casper-chai-detect/test/e2e/index.coffee

But mocha-casperjs says it should automatically detect them. Adding @roman01la in case it is grunt-mocha-casperjs issue

nathanboktae commented 10 years ago

This is due to #41 just by looking at the result of npm install. Let me publish a version with the fix.

nathanboktae commented 10 years ago

ah no it's not. I see what's happening. You have chai and casper-chai as dev dependencies, so npm doesn't install them adjacent to mocha-casperjs under grunt-mocha-casperjs. mocha-casperjs does not run under npm, which means simple require('chai') where chai is in some path that node knows about, like a parent node_modules directory, but phantomjs doesn't, does not work. it litterally needs to be adjacent to mocha-casperjs, otherwise you have to do what you did, or specify --chai-path and --capser-chai-path.

I removed chai and casper-chai from your node modules and it worked as you desired.