Note this likely only occurs in extremely rare cases. Tracking as a bug for proper documentation
This is fixed in #1694
nyc works by registering a JS setter on require.extensions[relevantExtension] which intercepts every time you set a value.
E.g. when you require.extensions['.js'] = someHook, nyc gets someHook and is able to wrap it.
For complex reasons, this is necessary.
If two different libraries decide to install require.extensions[] hooks, perhaps ts-node and something else, it's important that nyc's setter is preserved.
nyc ts-node ./install-yet-another-require-hook.ts
Our old preferTsExts behavior was removing nyc's setter when it re-ordered Object.keys(require.extensions)
Reproduction: https://github.com/TypeStrong/ts-node-repros/tree/preferTsExts-nyc-coverage
Note this likely only occurs in extremely rare cases. Tracking as a bug for proper documentation
This is fixed in #1694
nyc works by registering a JS setter on
require.extensions[relevantExtension]which intercepts every time you set a value.E.g. when you
require.extensions['.js'] = someHook, nyc getssomeHookand is able to wrap it.For complex reasons, this is necessary.
If two different libraries decide to install
require.extensions[]hooks, perhaps ts-node and something else, it's important thatnyc's setter is preserved.Our old
preferTsExtsbehavior was removing nyc's setter when it re-orderedObject.keys(require.extensions)Reproduction: https://github.com/TypeStrong/ts-node-repros/tree/preferTsExts-nyc-coverage