Skip to content

Commit

Permalink
Update Jest coverage reporters (#12845)
Browse files Browse the repository at this point in the history
The coverage reporter for the console has been changed from `text` to
`text-summary` because `text` was too long. It exceeded the maximum
length of the CircleCI terminal output shown on their jobs page, making
it very difficult to see why the unit test coverage job failed.

The text summary only displays overall coverage metrics, but that is
usually enough to indicate when the test fails due to a drop in
coverage. The more detailed breakdown is still available as a HTML
report linked in the `metamaskbot` comment, and in the `jest-coverage`
directory when run locally.

The three on-disk coverage reports used previously (`lcov`, `json`, and
`clover`) have been replaced with just `html`. The HTML report was part
of the `lcov` report, and it was the only one we were using.
  • Loading branch information
Gudahtt authored Dec 1, 2021
1 parent b6b202c commit 267cdc4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion development/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
displayName: '/development',
collectCoverageFrom: ['<rootDir>/**/*.js'],
coverageDirectory: '../jest-coverage/development/',
coverageReporters: ['json', 'lcov', 'text', 'clover'],
coverageReporters: ['html', 'text-summary'],
coverageThreshold: {
'./development/build/transforms/**/*.js': {
branches: 100,
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
collectCoverageFrom: ['<rootDir>/ui/**/*.js', '<rootDir>/shared/**/*.js'],
coverageDirectory: './jest-coverage/main',
coveragePathIgnorePatterns: ['.stories.js', '.snap'],
coverageReporters: ['json', 'lcov', 'text', 'clover'],
coverageReporters: ['html', 'text-summary'],
coverageThreshold: {
global: {
branches: 35,
Expand Down
2 changes: 1 addition & 1 deletion jest.stories.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/unambiguous */
module.exports = {
coverageDirectory: './jest-coverage/storybook',
coverageReporters: ['json', 'lcov', 'text', 'clover'],
coverageReporters: ['html', 'text-summary'],
// TODO: enable resetMocks
// resetMocks: true,
restoreMocks: true,
Expand Down

0 comments on commit 267cdc4

Please sign in to comment.