Cleaning up sinon stubs easily

前端 未结 8 1020
闹比i
闹比i 2020-12-07 13:38

Is there a way to easily reset all sinon spys mocks and stubs that will work cleanly with mocha\'s beforeEach blocks.

I see sandboxing is an option but I do not see

8条回答
  •  猫巷女王i
    2020-12-07 14:04

    restore() just restores the behavior of the stubbed functionality but it doesn't reset the state of the stubs. You'll have to either wrap your tests with sinon.test and use this.stub or individually call reset() on the stubs

提交回复
热议问题