-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: configure jest coverage #1222
Conversation
* next: Bump Maze Runner version for local running test(bugsnag-integrity): enforce integrity header for Expo
@@ -1,5 +1,4 @@ | |||
import BugsnagBrowserStatic from '..' | |||
import { Breadcrumb, Session } from '../types/bugsnag' | |||
import BugsnagBrowserStatic, { Breadcrumb, Session } from '../src/notifier' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to test against src rather than dist or coverage doesn't report correctly. As a consequence we lose the types, hence the colocated definitions file above that re-exports the types.
@@ -1,22 +0,0 @@ | |||
/* global jest */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be unused
@@ -27,11 +41,12 @@ module.exports = { | |||
'plugin-window-onerror', | |||
'plugin-strip-query-string', | |||
'plugin-interaction-breadcrumbs', | |||
'plugin-inline-script-content', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This oversight was picked up by the coverage report
Goal
To monitor code coverage and ensure high / increasing code quality.
Design
This is a fairly standard approach to generating code coverage reports with jest. jest supports many Istanbul reporters which are compatible with a range of viewers and CI setups.
This setup also includes files that do not have corresponding test files so provides a more accurate picture of the actual coverage of source.
This will also support (with additional work) danger bot to add code coverage comments on PRs.
Changeset
package.json
main
property was being used to resolve the import. This lead to tests being run on thedist/
output. Whilst testing on the final output has its merits it is more common to test against the source. If we run the tests against thedist/
output the coverage for the source file will be reported as zero.package.json
types
field.Testing
automated build and tests passing