layout | title | breadcrumb |
---|---|---|
page |
Migrating to v3.0 - Sinon.JS |
migrating to 3.0 |
As with all MAJOR
releases in semver
, there are breaking changes in sinon@3
.
This guide will walk you through those changes.
Please use sinon.stub(obj, "method").callsFake(func)
instead.
var stub = sinon.stub(obj, "stubbedMethod").callsFake(function () {
return 42;
});
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
Calling sinon.stub
with three arguments will throw an Error. This was deprecated with sinon@2
and has been removed with sinon@3
sinon.useFakeTimers()
signature has changed. To define which methods to fake, please use config.toFake
. Other options are now available when configuring useFakeTimers
. Please consult the documentation for more information.
The following internal functions were deprecated as of sinon@1.x
and have been removed in sinon@3
:
sinon.calledInOrder
sinon.create
sinon.deepEqual
sinon.format
sinon.functionName
sinon.functionToString
sinon.getConfig
sinon.getPropertyDescriptor
sinon.objectKeys
sinon.orderByFirstCall
sinon.restore
sinon.timesInWorlds
sinon.valueToString
sinon.walk
sinon.wrapMethod
sinon.Event
sinon.CustomEvent
sinon.EventTarget
sinon.ProgressEvent
sinon.typeOf
sinon.extend