Skip to content

Commit

Permalink
Only mock specific functions exported by istanbul-lib-coverage
Browse files Browse the repository at this point in the history
(instead of the whole module).
So that I can use the original createCoverageSummary function to
create test data.
  • Loading branch information
rhys williams committed May 29, 2018
1 parent 94f2331 commit 71b829e
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@
*/
'use strict';

jest
.mock('istanbul-lib-coverage')
.mock('istanbul-lib-source-maps')
.mock('istanbul-api');
jest.mock('istanbul-lib-source-maps').mock('istanbul-api');

let libCoverage;
let libSourceMaps;
let CoverageReporter;
let istanbulApi;

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

Expand Down Expand Up @@ -100,7 +96,7 @@ describe('onRunComplete', () => {
const file = path.resolve(f[0]);
const override = f[1];
const obj = Object.assign({}, covSummary, override);
c[file] = new CoverageSummary(obj);
c[file] = libCoverage.createCoverageSummary(obj);
return c;
}, {});

Expand Down

0 comments on commit 71b829e

Please sign in to comment.