Giter Club home page Giter Club logo

mocha-sinon's People

Contributors

diversario avatar elliotf avatar focusaurus avatar holdyourwaffle avatar holm avatar marshallofsound avatar papandreou avatar valorkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mocha-sinon's Issues

Question: why do we need create new sandbox before each test?

You recommend to use code like

var sinon = require('sinon');

beforeEach(function() {
  this.sinon = sinon.sandbox.create();
});

afterEach(function(){
  this.sinon.restore();
});

and something similar is happening inside module itself. What are the pros of such solution comparing to

var sinon = require('sinon').sandbox.create();

afterEach(function(){
  sinon.restore();
});

?

Doesn't work when mocha runs in watch mode

...because the module is only loaded by require() on the first test run. Suggest you make the module module.exports = function() and then the usage would be require('mocha-sinon')().

'Module loading scheme' not supported for browserify

I'm trying to use mocha-sinon in the browser with browserify where sinon isn't attached to window.

if (
    typeof window === "object"
    && typeof window.sinon === "object"
  ) {
    plugin(window.sinon);
  } else if (typeof require === "function" && typeof window === 'undefined') {
    var sinon = require('sinon');

    module.exports = function () {
      plugin(sinon);
    };

    plugin(sinon);
  } else {
    throw "This module loading schema is unsupported.  Pull requests are welcome!";
  }

The else if above works perfectly if the check for && typeof window === 'undefined' is removed. Is there a particular reason it needs to be there?

support mocha 2.x

peerDependencies is causing this to fail when installing

npm ERR! peerinvalid The package mocha does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants mocha@~1

"mocha-sinon relies on mocha having been loaded." with mocha 3.4.2

Hi!

Thanks for the lib! Unfortunately cant get it work with mocha 3.4.2

node_modules/mocha-sinon/mocha-sinon.js:5
    throw "mocha-sinon relies on mocha having been loaded.";
    ^
mocha-sinon relies on mocha having been loaded.

It seems like mocha does not expose beforeEach for modules required using cli args:

mocha -r mocha-sinon -r should -r should-sinon --recursive tests

Is there some solution for this?

Make "sinon" an actual dependency

Is there any particular reason that sinon remains as a dev-dependency as opposed to just a plain dependency? It just seems kind of redundant to have to type npm i -D sinon mocha-sinon instead of just installing mocha-sinon and letting it install sinon automatically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.