Closed tmcw closed 8 years ago
Mm... Perhaps just black-listing node_modules
is a better idea. I assume if I try running your tests I'll reproduce?
I think blacklisting node_modules should work, since the require cache should also keep files from being executed more than once. Yep, and you can tweak the tests in simple-statistics to test
This module is awesome! Starting to use it to test simple-statistics docs. One thing I ran into is that the trick for only testing the directly-required module ( https://github.com/yamadapc/jsdoctest/blob/master/lib/mocha.js#L74 ) runs into a bit of trouble when source files require each other: let's say you have
If both files have tests, then you'll initially require a, which requires b internally and b isn't turned into tests. then the next time you want b, it's in the require cache, so it isn't tested.
A workaround, which works but is slower:
This runs the test suite on each file, in order, so that each test run has a fresh require cache.