Skip to content

Commit

Permalink
fix: Add ts-ignore to reassignment of generated function (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyfarrell committed May 6, 2020
1 parent a99a13e commit 817efb0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/istanbul-lib-instrument/src/visitor.js
Expand Up @@ -534,7 +534,8 @@ const globalTemplateVariable = template(`
var global = GLOBAL_COVERAGE_SCOPE;
`);
// the template to insert at the top of the program.
const coverageTemplate = template(`
const coverageTemplate = template(
`
function COVERAGE_FUNCTION () {
var path = PATH;
var hash = HASH;
Expand All @@ -547,13 +548,18 @@ const coverageTemplate = template(`
}
var actualCoverage = coverage[path];
COVERAGE_FUNCTION = function () {
return actualCoverage;
{
// @ts-ignore
COVERAGE_FUNCTION = function () {
return actualCoverage;
}
}
return actualCoverage;
}
`);
`,
{ preserveComments: true }
);
// the rewire plugin (and potentially other babel middleware)
// may cause files to be instrumented twice, see:
// https://github.com/istanbuljs/babel-plugin-istanbul/issues/94
Expand Down

0 comments on commit 817efb0

Please sign in to comment.