freeCodeCamp / pantry-for-good

An open source food bank logistics and inventory management tool
Other
395 stars 189 forks source link

Add istanbul test coverage #321

Closed kenjiO closed 7 years ago

kenjiO commented 7 years ago

With these changes npm run coverage will generate a test coverage report in coverage/lcov-report/index.html

The one thing I don't like is that I think the babel-plugin-istanbul plugin also gets used with npm test when you want to run just the tests without creating a coverage report. From what I understand, istanbul adds extra code to every statement to keep track of what statements run. I don't like the idea of all that unnecessary code being put into regular test runs.

If you have any ideas on how to resolve this or if this shouldn't be a concern please let me know.

jspaine commented 7 years ago

Sweet! What is the coverage!?

How about just NODE_ENV=test_coverage and move it to a separate environment in babelrc?

kenjiO commented 7 years ago

The coverage is around 40%

I tried using NODE_ENV=test_coverage but then some of the tests failed. I think some of the tests depend on NODE_ENV being set to test.

jspaine commented 7 years ago

Yeah I think so, I'll just merge it for now then.

kenjiO commented 7 years ago

OK, if you notice the tests are running slower or any other unusual behavior lets just roll this back and apply it temporarily when we want to check the coverage