0xProject / 0x-monorepo

0x protocol monorepo - includes our smart contracts and many developer tools
Other
1.41k stars 466 forks source link

Allow project specific coverage ignore paths #1635

Closed barlock closed 5 years ago

barlock commented 5 years ago

Expected Behavior

As a user of sol-coverage I should be able to specify paths that I want to ignore from coverage so that I don't have to test my node_modules to get full test coverage.

Current Behavior

Right now, it just covers everything. Being able to ignore things allows me to ensure I can only focus on the code I want to.

Possible Solution

Intake a list of ignore paths, don't add those paths to the istanbul collector.

Context

This is getting run in a CI system with istanbul checking coverage.

Your Environment

Package Version
@0x/sol-coverage "^2.0.3"
@0x/sol-trace "^2.0.4"
Network
NAME
LogvinovLeon commented 5 years ago

Two questions.

  1. Would you be satisfied with just the boolean flag ignoreNodeModules (true by default) or do you need smth more complex than that?
  2. If you do - would you prefer glob or regex?
barlock commented 5 years ago

I want something more complex. In my current use case, I'm actually having to copy ERC721 contracts into my project as they don't have a payable modifier on transfer. I don't want these covered either.

I have this currently hacked together in a project https://github.com/ConsenSys/web3studio-bootleg/pull/125/files#diff-234b5ebe98eaf702468d693d7031023eR27

☝️ It's implemented with globs because of simplicity, but I would prefer regex to match other ignore formats (nyc, Jest, git, etc).