Skip to content

Commit 71b829e

Browse files
author
rhys williams
committed
Only mock specific functions exported by istanbul-lib-coverage
(instead of the whole module). So that I can use the original createCoverageSummary function to create test data.
1 parent 94f2331 commit 71b829e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

packages/jest-cli/src/reporters/__tests__/coverage_reporter.test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,13 @@
66
*/
77
'use strict';
88

9-
jest
10-
.mock('istanbul-lib-coverage')
11-
.mock('istanbul-lib-source-maps')
12-
.mock('istanbul-api');
9+
jest.mock('istanbul-lib-source-maps').mock('istanbul-api');
1310

1411
let libCoverage;
1512
let libSourceMaps;
1613
let CoverageReporter;
1714
let istanbulApi;
1815

19-
import {CoverageSummary} from 'istanbul-lib-coverage/lib/file';
2016
import path from 'path';
2117
import mock from 'mock-fs';
2218

@@ -100,7 +96,7 @@ describe('onRunComplete', () => {
10096
const file = path.resolve(f[0]);
10197
const override = f[1];
10298
const obj = Object.assign({}, covSummary, override);
103-
c[file] = new CoverageSummary(obj);
99+
c[file] = libCoverage.createCoverageSummary(obj);
104100
return c;
105101
}, {});
106102

0 commit comments

Comments
 (0)