Allow eager instantiation of instrumenter - #490
Conversation
|
Changes Unknown when pulling 9e77282 on evantorrie:eager into ** on istanbuljs:master**. |
|
@evantorrie this is neat, just reading the documentation on |
|
@evantorrie another thought comes to mind; is there any reason to not always enable |
It'll decrease performance in case the required modules have previously been instrumented. That's what |
|
@JaKXz realizing now that this is a feature of caching-transform, I think we can probably do without the test; trusting that it's sufficiently tested in the dependent library. @evantorrie this is looking good to me; this is also enough of a power feature that I could be convinced that the command line argument is sufficient documentation; perhaps we could switch it to: I'll also be quite curious to see the benchmarks of using both approaches on a few large projects after we land this -- given that we have some expensive dependencies like |
Some mocking libraries hook require and warn when there is a required module which has not been explicitly registered (e.g. mockery). It is standard procedure to enable these mock hooks in a unit test prior to requiring the code under test. With lazy instantiation of the instrumenter, all of the instrumenter library's `require`s generate warnings at test time. This change adds an `--eager` option to nyc which forces instantiation of the instrumentation library prior to walking any of the files, thus eliminating any warnings from mockery.
|
I've changed the command line description to reference Per discussion above, my use-case for this is mostly in running continuous integration via Jenkins which has a fresh checkout from source on each build. Thus, I never get any benefit from the caching transforms (although obviously I recognize you do if this is run in your dev directory/env). |
|
Changes Unknown when pulling df3428e on evantorrie:eager into ** on istanbuljs:master**. |
|
@evantorrie looks great, I'll look into landing this ASAP. |
|
@evantorrie I've released this feature in the
Look forward to more contributions in the future, thanks! 🎉 |
This change adds an
--eageroption to nyc which forces instantiationof the instrumentation library prior to walking any of the files.
Addresses #491