How to add packages require()'d by tests

Hi all,

In a cucumber feature_steps.js file, I want to use chai, so I write:

chai = require('chai');

However, cucumber fails saying that that it can’t find the module chai, even though it is used by xolvio:cucumber itself. I can get things to work with:

cd tests/cucumber
mkdir node_modules
cd node_modules
ln -s ~/.meteor/packages/xolvio_cucumber/.0.6.0.skb9g1++os+web.browser+web.cordova/npm/node_modules/chai .

Is that the correct approach or is there a better way? If that is the correct approach, is there a way to ensure that other developers get chai installed in the correct spot without adding tests/cucumber/node_modules to my git repo?


P.S. I’m a node/meteor/velocity/cucumber noob so I could be missing something really obvious here.

But it’s packages only

1 Like

Thanks! That’s what I needed. I just created and added my own chai meteor package that uses Npm.depends to pull in the chai npm module.

Hey Brettle

What’s your use-case? I ask because xolcio:cucumber comes with chai baked in.

I want to call chai.should() within a cucumber feature_steps.js file to enable should style. So I call:


That causes cucumber to fail with an inabiltly to resolve ‘chai’.

This is already done for you :wink: Check out this line:

You can just call should like this:

Notice how you can also use chai-as-promised to save yourself some ugly callback nesting

Good to know, but there doesn’t appear to be access to the ‘should’ object
(as opposed to the ‘should’ property). Typical usage looks like this:

should = chai.should();

I understand

If you put a feature request on cucumber (github issues) I can have it on my list for a future release

Done. It’s issue 327.