0

I'm using mochify for unit testing, and would like to add some spies/mocks/stub capabilities. The package to use, it seems, is sinon, but my experience has been:

1) Install sinon as described in the docs and a dozen or more tutorials:

npm install sinon --save-dev

2) Add a spy to my tests:

var sinon = require('sinon');

...

it('yadda yadda', function() {
    var callback = sinon.spy();

    ...

3) Run my tests:

mochify

But what I get is:

Error: module "buster-core" not found from ...

What is buster? If I npm install buster-core, I just get another one; buster-test. I install that one and need buster-assertions...

What's going on here?

Thanks

nicholas
  • 14,184
  • 22
  • 82
  • 138

1 Answers1

0

It looks like the issue was mochify was trying to test Sinon itself... bad config on my part.

I fixed it by focusing mochify's testing to only my app directory as it should have been. Also I forked SinonJS (https://github.com/nicholasstephan/Sinon.JS.git) and added the /test directory the it's .npmignore as seems to be good practice. (Exclude test code in npm package?)

Community
  • 1
  • 1
nicholas
  • 14,184
  • 22
  • 82
  • 138