The accepted answer extends to misinformation and should be considered harmful.
One of the main goals of a mocking library, such as Mocha, is to automatically disable the layout / stub as part of integration into various test libraries. In fact, if you look at the GitHub repo for Mocha , you will see that significant maintenance efforts are aimed at making Mocha work smoothly with all versions of several different testing frameworks.
If this does not work properly, you need to find out why Mocha's built-in stall does not work. A manual mismatch in your own break is just a paper problem and can mask more subtle problems with a stub or Mocha leak, otherwise the behavior is wrong.
If I had to take wild money, then the money on your stub would somehow run outside the actual test, because this is the most common reason that I saw for this kind of thing in the wild, but there is not enough information from the question to really install.
source share