From 24d822848f576554e8f2ce99ef0bcac76ad0b2fe Mon Sep 17 00:00:00 2001 From: Aftab Khan Date: Tue, 16 Jan 2018 16:01:43 +0530 Subject: [PATCH] Removed instrument check before saving sourceMap. Updated the changelog with this pull --- CHANGELOG.md | 1 + .../coverage_remapping_inline_sourcemap.test.js.snap | 0 .../__tests__/coverage_remapping_inline_sourcemap.test.js | 0 .../__tests__/covered-test.js | 0 .../coverage-remapping-inline-sourcemap/covered.js | 0 .../coverage-remapping-inline-sourcemap/package.json | 0 packages/jest-runtime/src/script_transformer.js | 4 +++- 7 files changed, 4 insertions(+), 1 deletion(-) rename {integration_tests => integration-tests}/__tests__/__snapshots__/coverage_remapping_inline_sourcemap.test.js.snap (100%) rename {integration_tests => integration-tests}/__tests__/coverage_remapping_inline_sourcemap.test.js (100%) rename {integration_tests => integration-tests}/coverage-remapping-inline-sourcemap/__tests__/covered-test.js (100%) rename {integration_tests => integration-tests}/coverage-remapping-inline-sourcemap/covered.js (100%) rename {integration_tests => integration-tests}/coverage-remapping-inline-sourcemap/package.json (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36682127615e..6a8f9742e435 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Fixes +* `[jest-runtime]` Removed check for `mapCoverage` boolean before attempting to read inlineSourceMaps. [#5177](https://github.com/facebook/jest/pull/5177) * `[jest-cli]` Fix `EISDIR` when a directory is passed as an argument to `jest`. ([#5317](https://github.com/facebook/jest/pull/5317)) diff --git a/integration_tests/__tests__/__snapshots__/coverage_remapping_inline_sourcemap.test.js.snap b/integration-tests/__tests__/__snapshots__/coverage_remapping_inline_sourcemap.test.js.snap similarity index 100% rename from integration_tests/__tests__/__snapshots__/coverage_remapping_inline_sourcemap.test.js.snap rename to integration-tests/__tests__/__snapshots__/coverage_remapping_inline_sourcemap.test.js.snap diff --git a/integration_tests/__tests__/coverage_remapping_inline_sourcemap.test.js b/integration-tests/__tests__/coverage_remapping_inline_sourcemap.test.js similarity index 100% rename from integration_tests/__tests__/coverage_remapping_inline_sourcemap.test.js rename to integration-tests/__tests__/coverage_remapping_inline_sourcemap.test.js diff --git a/integration_tests/coverage-remapping-inline-sourcemap/__tests__/covered-test.js b/integration-tests/coverage-remapping-inline-sourcemap/__tests__/covered-test.js similarity index 100% rename from integration_tests/coverage-remapping-inline-sourcemap/__tests__/covered-test.js rename to integration-tests/coverage-remapping-inline-sourcemap/__tests__/covered-test.js diff --git a/integration_tests/coverage-remapping-inline-sourcemap/covered.js b/integration-tests/coverage-remapping-inline-sourcemap/covered.js similarity index 100% rename from integration_tests/coverage-remapping-inline-sourcemap/covered.js rename to integration-tests/coverage-remapping-inline-sourcemap/covered.js diff --git a/integration_tests/coverage-remapping-inline-sourcemap/package.json b/integration-tests/coverage-remapping-inline-sourcemap/package.json similarity index 100% rename from integration_tests/coverage-remapping-inline-sourcemap/package.json rename to integration-tests/coverage-remapping-inline-sourcemap/package.json diff --git a/packages/jest-runtime/src/script_transformer.js b/packages/jest-runtime/src/script_transformer.js index 88cd535d7b7e..d35e10d01c6f 100644 --- a/packages/jest-runtime/src/script_transformer.js +++ b/packages/jest-runtime/src/script_transformer.js @@ -243,6 +243,8 @@ 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 = convertSourceMap.fromSource(transformed.code); if (inlineSourceMap) { transformed.map = inlineSourceMap.toJSON(); @@ -259,7 +261,7 @@ export default class ScriptTransformer { code = transformed.code; } - if (instrument && transformed.map) { + if (transformed.map) { const sourceMapContent = typeof transformed.map === 'string' ? transformed.map