Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixes #18 #30

wants to merge 1 commit into


None yet
4 participants

By default, a call to require(module) will cache module. This however causes simple-mocha tests to be executed only once when run multiple times (e.g. as part of a regarde/watch task). This fix will delete the test modules from the require() cache prior to each run.

Also see #18.

Nice! It actually occured to me this morning that this might be the issue, but I hadn't gotten to look into it. Thanks!


yaymukund commented Apr 9, 2013

Can you do this in one of grunt-regarde's events?

I feel like it's the watch task's job to ensure that the process's require cache is clean (or at least to provide hooks as they have done here).

The watch task was just an example; running grunt simplemocha simplemocha will result in the same behavior. I feel running the same test suite twice should yield the same results. It should be the test's task job to make sure the tests actually run correctly.

Seems like my solution doesn't take nested require()s into account.

This can be supported by obtaining the pre-require and post-require caches, and delete the difference set. This works as a quick solution, yet I'm hoping someone can come up with a better way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment