问题
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?
EDIT---------------------------- ---------09.09.2016
meanwhile i've found out that I need to install typings like
typings install dt~sinon --save --global
But now I'm getting this error
ReferenceError: Can't find variable: sinon in /var/folders/ld/2g86bbq11tddvbnzlzbtg2r80000gn/T/78dc4c45b42a2dd7bfcfb607366d1d15.browserify (line 350)
来源:https://stackoverflow.com/questions/39329300/how-to-add-sinon-to-angular-2-testing