Skip to content

Commit

Permalink
Remove the concept of using Jest's stored sourceMaps to map BabelCove…
Browse files Browse the repository at this point in the history
…rage - inputSourceMap should always be available.
  • Loading branch information
Matthew Preble committed Apr 18, 2020
1 parent 965c4b4 commit f1f3448
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
7 changes: 0 additions & 7 deletions packages/jest-reporters/src/coverage_reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,6 @@ export default class CoverageReporter extends BaseReporter {
]);
} else {
this._coverageMap.addFileCoverage(result.coverage);

if (result.sourceMapPath) {
this._sourceMapStore.registerURL(
filename,
result.sourceMapPath,
);
}
}
}
} catch (error) {
Expand Down
10 changes: 5 additions & 5 deletions packages/jest-reporters/src/generateEmptyCoverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export type CoverageWorkerResult =
| {
kind: 'BabelCoverage';
coverage: FileCoverage;
sourceMapPath?: string | null;
}
| {
kind: 'V8Coverage';
Expand Down Expand Up @@ -66,17 +65,18 @@ export default function (
}

// Transform file with instrumentation to make sure initial coverage data is well mapped to original code.
const {code, mapCoverage, sourceMapPath} = new ScriptTransformer(
config,
).transformSource(filename, source, true);
const {code} = new ScriptTransformer(config).transformSource(
filename,
source,
true,
);
// TODO: consider passing AST
const extracted = readInitialCoverage(code);
// Check extracted initial coverage is not null, this can happen when using /* istanbul ignore file */
if (extracted) {
coverageWorkerResult = {
coverage: createFileCoverage(extracted.coverageData),
kind: 'BabelCoverage',
sourceMapPath: mapCoverage ? sourceMapPath : null,
};
}
}
Expand Down
3 changes: 0 additions & 3 deletions packages/jest-transform/src/ScriptTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ export default class ScriptTransformer {
// two separate processes write concurrently to the same cache files.
return {
code,
mapCoverage: false,
originalCode: content,
sourceMapPath,
};
Expand Down Expand Up @@ -385,7 +384,6 @@ export default class ScriptTransformer {

return {
code,
mapCoverage: false,
originalCode: content,
sourceMapPath,
};
Expand Down Expand Up @@ -431,7 +429,6 @@ export default class ScriptTransformer {

return {
code,
mapCoverage: false,
originalCode: content,
sourceMapPath,
};
Expand Down
1 change: 0 additions & 1 deletion packages/jest-types/src/Transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
export type TransformResult = {
code: string;
originalCode: string;
mapCoverage: boolean;
sourceMapPath: string | null;
};

0 comments on commit f1f3448

Please sign in to comment.