Open pmendelski opened 10 years ago
Good point, I have spent quite some time to find out that clearing require.cache
is not enough. It would be great to describe how blanket works under the hood (just few sentences in documentation).
BTW. I also noticed that require.extensions
is deprecated. Do you have any idea on how to replace it with different mechanism?
And of course many thanks for creating and supporting blanket. It is really great!
related to our prob here? : https://github.com/thlorenz/proxyquire/issues/33
@bsodzik can you say more about why clearing require.cache
was insufficient to solve your problems? Clearing it in my require.extensions
handler fixed a similar problem that I was having.
@danvk, besides clearing require.cache
we also had to restore require.extensions['.js']
after blanket had finished its work (as @mendlik mentioned in his post). Now I see that blanket provides method restoreNormalLoader
which is doing exactly what we implemented in our code. Unfortunately, back in February 2014 there was neither a documentation for that method nor a good soul to tell us about its existence.
What is a little bit worrying is that there is still no documentation for restoreNormalLoader
. Maybe that method is not needed any more, but it still exists in blanket code..
Hi,
I'm using blanket.js for test coverage. It's a great tool - thanks!
Although I found some minor bug.
Scenario: I want to run instrumnted tests. If they fail I would like to rerun the tests but without instrumentalization. I'm using grunt with grunt-mocha-test plugin like this:
I created a grunt task that executes this scenario and in case of testcov error runs not instrumented tests. Although because of line 128 in blanket/src/index.js (blanket version 1.1.6) once instumented tests stayed instrumented for all other tasks.
Fix I had to restore
require.extensions['.js']
function manually to fix it. I think you could do the same in blanket to prevent this strange situation.Cheers!