The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Ensure all source files are included in test coverage reports with Webpack

Ensure all source files are included in test coverage reports with Webpack

4:59
If you’re only instrumenting the files in your project that are under test then your code coverage report will be misleading and it will be difficult for you to track or enforce improvements to application coverage over time. In this lesson we’ll learn how to ensure all source files are included in coverage reports and how to enforce a specific threshold so you can work toward improving application code coverage.
Watch this lesson now
Avatar
egghead.io

If you’re only instrumenting the files in your project that are under test then your code coverage report will be misleading and it will be difficult for you to track or enforce improvements to application coverage over time. In this lesson we’ll learn how to ensure all source files are included in coverage reports and how to enforce a specific threshold so you can work toward improving application code coverage.

Avatar
Kent C.

You'll want to make certain that the glob is correct for your srcGlob. Negative patterns can be a little tricky, so if you're having trouble, see: http://stackoverflow.com/a/37851445/971592

Avatar
Carlos

Is there a way to make it work with typescript? i've made tests work with webpack and ts, but coverage keeps throwing an error at me, maybe because i'm using typescript while testing a node app using the NW.js runtime as browser to be able to run node in it?:

Chrome 41.0.2272 (Mac OS X 10.12.2) ERROR
  Uncaught TypeError: undefined is not a function
  at src/server.ts:440
In reply to egghead.io
Avatar
Kent C.

I recommend you try using Jest with ts-jest instead of trying to make Karma with NW.js work... Jest is really popular, has a great community, awesome features, and is actively maintained.

In reply to Carlos
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?