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 f9e1084 commit 6305bfc
Showing 1 changed file with 2 additions and 6 deletions.
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 6305bfc

Please sign in to comment.