felixge / node-sandboxed-module

A sandboxed node.js module loader that lets you inject dependencies into your modules.
MIT License
342 stars 42 forks source link

Support for JSCoverage #29

Closed elliotstokes closed 10 years ago

elliotstokes commented 10 years ago

I'm computing code coverage using the lcov reporter in nodeunit with code instrumented with jscoverage. If I load the module with the standard require it correctly computes code coverage but not when the module is Sandboxed.

Any plans to support code coverage? I see there is some support for istanbul.

searls commented 10 years ago

I think @domenic & @felixge's stance was both that it made more sense to keep this module small and provide an API for integrating additional "source transformers" (like preprocessors / instrumenters). I added that API just after I added support for istanbul. To add support for lcov, you'll need to write your own sourceTransformer and pass it in as a named property on an object to SandboxedModule as sourceTransformers. Check out the source to get an idea.