markafitzgerald1 / cribbage-trainer

Two-player cribbage discard and play improvement tool.
Mozilla Public License 2.0
1 stars 0 forks source link

Automatically verify 100% direct unit test coverage per source file #31

Closed markafitzgerald1 closed 9 months ago

markafitzgerald1 commented 10 months ago

Add this to reduce the likelihood of having only indirect test coverage on modules which does not assert meaningfully about the modules.

At present one module does not have any direct tests at all.

markafitzgerald1 commented 9 months ago

This can be done via a shell script iterating over each .ts and .tsx file, running Jest in --coverage mode on each file. However, it can be tricky as source files declaring and exporting only interfaces or constant values will not have corresponding test files as their code is not meaningfully directly unit testable.

One could work around this via naming conventions to work with the script, but... I'm not sure if it is worth its initial (complex script, rename some files) and ongoing (maintain interface, enum, const-only and other non-unit-testable file naming conventions over time) cost.

Closing for now as perhaps not worth its cost at present given that the one file found with no direct test coverage had the test coverage added and no meaningful tests were missing. I may come back to this issue later should its cost or value change with time.