cjohansen / sinon-nodeunit

A small Sinon.JS adapter for nodeunit that provides automatic sandboxing of mocks and stubs

Home Page:http://cjohansen.no/sinon/nodeunit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot find module 'sinon/sandbox'

liangzan opened this issue · comments

Hi,

I'm running your sinon-nodeunit-examples.js And I'm getting the error above. I've installed sinon 1.0.0, sinon-nodeunit 0.1.0, nodeunit 0.5.0.

I've checked the npm files. sandbox.js is there. I'll be trying to solve it on my own. Let me know if there's anything I did wrongly

Bug in Sinon.JS. I just pushed 1.0.1 to npm thanks to a patch. Try installing it again.

Hi,

It still does not work. I believe the offending line is

//sinon.sandbox = require("sinon/sandbox");
//sinon.assert = require("sinon/assert");

I commented it out and did a puts and is able to see sinon.sandbox. However it cannot find nodeunit's core module later.

Ah, the load paths where not correctly set up. Sorry, I'm a bit of a npm noob. Fixed now, and pushed 0.1.1 to npm. I was able to run examples now using 0.1.1 from npm.

There are a few snags though. I had to patch nodeunit to do what I needed to do, so until Caolan updates his repo, you have to use the bundled version. I created a runner file like this:

require("sinon-nodeunit");

var reporter = require('nodeunit').reporters.default;
reporter.run(['./examples.js']);

thanks! its working. great work!