Thursday 23 August 2018

mock-require bleeds between test files

Hi, long time lurker here.I have a small node app that synchronizes data between two api's and I've been writing tests for it using mocha, chai, mock-require and sinon. To import modules in the app I use require, and to mock this I have opted for "mock-require". My problem is that the mocksetups seems to bleed in to eachother. The only way to run the test is to comment out all the other tests than the file I am working on.I use the mocha lifecycle method to stop all mocks after the tests have finished and have also tried using the sinon sandbox without luck.How do you guys set up your tests in node? Is there an alternative to mock-require that might work better for me?Thanks

Submitted August 23, 2018 at 06:15AM by reeferd

No comments:

Post a Comment