Skip to content

Commit

Permalink
Prefer Babel for Jest coverage (#1066)
Browse files Browse the repository at this point in the history
* Change coverage provider

* Fix coverage

* Add codecov for snaps-controllers

* Stop including test-utils in coverage
  • Loading branch information
FrederikBolding committed Dec 14, 2022
1 parent e7123bb commit 2ed41d3
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
- run: yarn --immutable
- run: yarn build
- run: yarn workspace @metamask/snaps-controllers run test:ci
- name: CodeCov
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
- name: Require clean working directory
shell: bash
run: |
Expand Down
8 changes: 6 additions & 2 deletions jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ module.exports = {
collectCoverage: true,

// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: ['./src/**/*.ts', '!./src/**/*.test.ts'],
collectCoverageFrom: [
'./src/**/*.ts',
'!./src/**/*.test.ts',
'!./src/test-utils/**/*.ts',
],

// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
Expand All @@ -31,7 +35,7 @@ module.exports = {
coveragePathIgnorePatterns: ['./src/index.ts'],

// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
coverageProvider: 'babel',

// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['html', 'json-summary', 'text', 'json'],
Expand Down
8 changes: 4 additions & 4 deletions packages/rpc-methods/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ module.exports = deepmerge(baseConfig, {
coveragePathIgnorePatterns: ['./src/index.ts'],
coverageThreshold: {
global: {
branches: 87.09,
functions: 87.27,
lines: 83.27,
statements: 83.27,
branches: 74.63,
functions: 83.33,
lines: 83.46,
statements: 82.44,
},
},
testTimeout: 2500,
Expand Down
8 changes: 4 additions & 4 deletions packages/snaps-cli/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ module.exports = deepmerge(baseConfig, {
coveragePathIgnorePatterns: ['./src/types'],
coverageThreshold: {
global: {
branches: 97.89,
functions: 98.07,
lines: 99.47,
statements: 99.47,
branches: 98.09,
functions: 94.66,
lines: 98.49,
statements: 98.5,
},
},
setupFiles: ['./test/setup.js'],
Expand Down
8 changes: 4 additions & 4 deletions packages/snaps-controllers/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const baseConfig = require('../../jest.config.base');
module.exports = deepmerge(baseConfig, {
coverageThreshold: {
global: {
branches: 91.04,
functions: 97.45,
lines: 97.45,
statements: 97.45,
branches: 87.92,
functions: 94.44,
lines: 95.6,
statements: 95.52,
},
},
projects: [
Expand Down
8 changes: 4 additions & 4 deletions packages/snaps-execution-environments/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ module.exports = deepmerge(baseConfig, {
coveragePathIgnorePatterns: ['./src/index.ts', '.ava.test.ts'],
coverageThreshold: {
global: {
branches: 89.78,
functions: 90.51,
lines: 88.46,
statements: 88.46,
branches: 83.68,
functions: 92.19,
lines: 87.11,
statements: 87.22,
},
},
testEnvironment: '<rootDir>/jest.environment.js',
Expand Down
8 changes: 4 additions & 4 deletions packages/snaps-utils/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ module.exports = deepmerge(baseConfig, {
],
coverageThreshold: {
global: {
branches: 94.42,
functions: 97.95,
lines: 95.11,
statements: 95.11,
branches: 91.31,
functions: 99.28,
lines: 98.89,
statements: 98.91,
},
},
testTimeout: 2500,
Expand Down

0 comments on commit 2ed41d3

Please sign in to comment.