node express es6 sinon stubbing middleware not working

前端 未结 1 1897
独厮守ぢ
独厮守ぢ 2021-01-06 05:40

I am writing the mocha unit test for the my express router. I found that however I try to stub the middleware, it still execute the middleware code. Here is my router &

相关标签:
1条回答
  • 2021-01-06 06:02

    This is likely because the stub happened after the module has been loaded already. You probably need to clear the cache first for your router file and then load it in again after the stubbing because es6 will cache the imported modules.

    0 讨论(0)
提交回复
热议问题