-
Notifications
You must be signed in to change notification settings - Fork 103
Description
I'm using cloverage in a project together with prismatic-schemas. I need to ignore some specific functions in coverage support, otherwise my % Forms
degrades a lot with lots of false positives. The reason lies in the way schemas work:
When I'm developing my apps, I need to be sure that I'm parsing JSON messages correctly - sanitizing functions, checking if a map is missing a required key, and so on.
So, to test my code, I'm using s/defn
- it defines a function that will check if their parameters, and its return, matches the specific schema that you said. This kind of checking is done only on test-time - in production, we disable schemas. The reason is performance, and the fact that we're checking schemas as a kind of "sanity-check" to see if we're at least passing the right "types" or "maps" to functions.
Now, the problem is that cloverage things that our s/def
line - which is exactly a function definition - is not fully covered. In my code, it says: 72 of 138 forms covered, which is way too much and degrades my coverage by a lot. The problem is that forms that are not covered are mostly tests that we'll never have in production, like "when schema does not match, throws exception". This will never happen - when a schema is wrong, we need sanitize it before calling the function...
So, I need a way to just say "ignore this form, move on to the next one", otherwise every function definition will mislead my function coverage...