Effect CommunityEC
Effect Communityβ€’3y agoβ€’
15 replies
Kristian Notari

Coverage Issue with Exported Functions as Constants

Hello everyone, I'm using vitest as unit test and coverage tool. When analyzing coverage, if I export functions as constants by composing other functions directly, coverage always seems to be 100%. Like:

export const f = flatMap(identity) // 100% even if I never use nor test f anywhere

export const g = (a: A) => flatMap(a, identity) // correctly yells for 0% coverage 


I can see WHY this is happening, but what solution is out there to prevent from shipping untested functions by leveraging coverage tresholds? I was pretty confident in shipping a 100% coverage lib but then I found out about this.
Was this page helpful?