lundi 5 septembre 2016

How to add Sinon to angular 2 testing?

I want to add Sinon for testing but I can't get it to run.

I've installed sinon and karma-sinon as DevDependencies.

added sinon to Frameworks in my karma config file.

 frameworks: ['jasmine', 'browserify','sinon'],

and in my test file I'm trying to declare a spy

let setTokenSpy = sinon.spy(sbHttpObiject, 'checkForToken');

and I'm getting

TypeScript error: app/sdk/test/http.spec.ts(87,22): Error TS2304: Cannot find name 'sinon'.

Any help much appreciated! Btw, i think jasmine has also spies but i can't get them to run either, any updates on that?

Aucun commentaire:

Enregistrer un commentaire