istanbuljs / nyc

the Istanbul command line interface
https://istanbul.js.org/
ISC License
5.6k stars 359 forks source link

Exclude Some Functions From Being Instrumented #1450

Open stahlbauer opened 2 years ago

stahlbauer commented 2 years ago

Context

I am instrumenting a files that were created using JS bundlers (Webpack or Vite).

Observed Behavior

Currently, a given JS file gets instrumented fully and there is no way to exclude some functions or other code fragments from being instrumented.

Expected Behavior

I would like to have a hook or some sort of parameter allowing me to exclude some code fragments from being instrumented.

Question

Is there already such a hook? Would a pull request with such a hook be accepted? Any hints on how to implement it?

stahlbauer commented 2 years ago

Please also indicate if this issue should be "moved" to https://github.com/istanbuljs/istanbuljs