Git Product home page Git Product logo

Comments (9)

princed avatar princed commented on June 18, 2024

I didn't quite understand, what you are talking about.
Sinon works pretty well in my own tests.

Could you provide your configuration example?

from karma-chai-plugins.

davidshen84 avatar davidshen84 commented on June 18, 2024

On http://chaijs.com/plugins/sinon-chai, it says I can use:

mySpy.should.have.been.calledWith("foo");

But I cannot use this form of assertion with karma-chai-plugins. From https://github.com/princed/karma-chai-plugins/blob/master/chai-adapter.js, I can see you did not call chai.use(sinonChai).

from karma-chai-plugins.

princed avatar princed commented on June 18, 2024

Are you using karma-chai-plugins without requirejs?
In that case sinon-chai plugs in automatically.

Otherwise karma-chai-plugins generates chai.use call for plugins.

from karma-chai-plugins.

davidshen84 avatar davidshen84 commented on June 18, 2024

No, I were not using requirejs...I did not know it is a required feature for this plugin. thanks.

from karma-chai-plugins.

princed avatar princed commented on June 18, 2024

No, requirejs in not required.

Could you provide example of your tests which are using sinon?

from karma-chai-plugins.

davidshen84 avatar davidshen84 commented on June 18, 2024

My karmar.conf.js

// frameworks to use
frameworks: ['mocha', 'chai', 'sinon-chai'],

Currently I have to use removeSpy.calledWith({"data": 'test'}).should.be.ok

from karma-chai-plugins.

princed avatar princed commented on June 18, 2024

I've tested without requirejs:
frameworks: ['mocha', 'chai', 'sinon-chai', 'chai-as-promised'],

it('Should spy', function () {
  var spy = sinon.spy();
  spy('test');
  spy.should.have.been.calledWith('test');
});

And all seems to work quite good.
Which errors do you see using should.have.been.calledWith?

from karma-chai-plugins.

davidshen84 avatar davidshen84 commented on June 18, 2024

errr...sorry. Last time, it said something like should is not defined. now, it works.

from karma-chai-plugins.

princed avatar princed commented on June 18, 2024

Nevermind.

from karma-chai-plugins.

Related Issues (20)

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.