gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 786 forks source link

Istanbul ignores excludes when invoked from API #615

Closed clentfort closed 6 years ago

clentfort commented 8 years ago

I'm not sure if this is by design, but it seems that istanbul, when invoked via API, does not respect the excludes specified in the .istanbul.yml.

Take for example a current project of mine as an exampl. It uses the jest-testrunner which uses instanbul as proposed in the README. The filename passed to instabul is something of the like /home/clentfort/js/another-selector/parser/src/parser/Errors.js (I verified this by adding a console.log(filename) before the line), which is excluded in my .istanbul.yml (I verified the config is loaded and my excludes are set by calling console.log(new Configuration(configObject, overrides)) in loadFile.) To reproduce it's enough to clone the repo, run ./node_modules/.bin/jest --coverage from the root of the project and to observe that src/parser/Errors.js is included in the coverage report (which is excluded by the instabul.yml).