Skip to content

Commit

Permalink
Don't fail the test suite when convert-source-map throws an error
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Landau committed Oct 16, 2019
1 parent d74da1a commit f4ce384
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/jest-transform/src/ScriptTransformer.ts
Expand Up @@ -296,12 +296,16 @@ export default class ScriptTransformer {
}

if (!transformed.map) {
//Could be a potential freeze here.
//See: https://github.com/facebook/jest/pull/5177#discussion_r158883570
const inlineSourceMap = sourcemapFromSource(transformed.code);
try {
//Could be a potential freeze here.
//See: https://github.com/facebook/jest/pull/5177#discussion_r158883570
const inlineSourceMap = sourcemapFromSource(transformed.code);

if (inlineSourceMap) {
transformed.map = inlineSourceMap.toJSON();
if (inlineSourceMap) {
transformed.map = inlineSourceMap.toJSON();
}
} catch (e) {
// Error processing the source map; proceed as if it doesn't exist.
}
}

Expand Down

0 comments on commit f4ce384

Please sign in to comment.