From 691b565e197027aadea8d881bbf0386597a11124 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Wed, 12 Jul 2017 17:34:26 +0100 Subject: [PATCH] fix(index): correct loader sourcemaps usage (#67) * fix: pass sourcemaps to istanbul --- package-lock.json | 42 +++++++++++++++++++++++++-- package.json | 2 ++ src/index.js | 14 +++++++-- test/__snapshots__/index.test.js.snap | 9 +++--- test/fixtures/basic.js | 4 --- test/index.test.js | 4 +-- test/utils/loader.js | 19 ++++++++---- test/utils/webpack.js | 3 ++ 8 files changed, 77 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 11ab64c..8115869 100644 --- a/package-lock.json +++ b/package-lock.json @@ -507,6 +507,17 @@ "babel-preset-jest": "20.0.3" } }, + "babel-loader": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-7.1.1.tgz", + "integrity": "sha1-uHE0yLEuPkwqlOBUYIW8aAorhIg=", + "dev": true, + "requires": { + "find-cache-dir": "1.0.0", + "loader-utils": "1.1.0", + "mkdirp": "0.5.1" + } + }, "babel-messages": { "version": "6.23.0", "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", @@ -1455,6 +1466,12 @@ "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", "dev": true }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, "compare-func": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-1.3.2.tgz", @@ -1721,8 +1738,7 @@ "convert-source-map": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", - "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", - "dev": true + "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=" }, "core-js": { "version": "2.4.1", @@ -2669,6 +2685,28 @@ "integrity": "sha1-w8T2xmO5I0WamqKZEtLQMfFQf4Q=", "dev": true }, + "find-cache-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", + "integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=", + "dev": true, + "requires": { + "commondir": "1.0.1", + "make-dir": "1.0.0", + "pkg-dir": "2.0.0" + }, + "dependencies": { + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "2.1.0" + } + } + } + }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", diff --git a/package.json b/package.json index 9ccf8b3..6cf8995 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "dist" ], "dependencies": { + "convert-source-map": "^1.5.0", "istanbul-lib-instrument": "^1.7.3", "loader-utils": "^1.1.0" }, @@ -39,6 +40,7 @@ "devDependencies": { "babel-cli": "^6.24.0", "babel-jest": "^20.0.3", + "babel-loader": "^7.1.1", "babel-plugin-transform-object-rest-spread": "^6.23.0", "babel-polyfill": "^6.23.0", "babel-preset-env": "^1.6.0", diff --git a/src/index.js b/src/index.js index 9fb49a9..194f367 100644 --- a/src/index.js +++ b/src/index.js @@ -1,11 +1,21 @@ import { createInstrumenter } from 'istanbul-lib-instrument'; import loaderUtils from 'loader-utils'; +import convert from 'convert-source-map'; + +export default function (source, sourceMap) { + let srcMap = sourceMap; + // use inline source map, if any + if (!srcMap) { + const inlineSourceMap = convert.fromSource(source); + if (inlineSourceMap) { + srcMap = inlineSourceMap.sourcemap; + } + } -export default function (source) { const options = Object.assign({ produceSourceMap: true }, loaderUtils.getOptions(this)); const instrumenter = createInstrumenter(options); instrumenter.instrument(source, this.resourcePath, (error, instrumentedSource) => { this.callback(error, instrumentedSource, instrumenter.lastSourceMap()); - }); + }, srcMap); } diff --git a/test/__snapshots__/index.test.js.snap b/test/__snapshots__/index.test.js.snap index 098e78e..c2b479b 100644 --- a/test/__snapshots__/index.test.js.snap +++ b/test/__snapshots__/index.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`disabled sourcemaps 1`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///./test/fixtures/basic.js\\"],\\"names\\":[],\\"mappings\\":\\";;;;AAAA,8BAA8B,oJAAoJ,wCAAwC,KAAK,OAAO,gBAAgB,MAAM,kBAAkB,MAAM,OAAO,gBAAgB,MAAM,kBAAkB,MAAM,OAAO,gBAAgB,MAAM,mBAAmB,QAAQ,KAAK,2BAA2B,OAAO,gBAAgB,MAAM,iBAAiB,MAAM,OAAO,gBAAgB,MAAM,iBAAiB,QAAQ,MAAM,2BAA2B,OAAO,gBAAgB,MAAM,iBAAiB,MAAM,OAAO,gBAAgB,MAAM,iBAAiB,SAAS,aAAa,IAAI,kBAAkB,IAAI,YAAY,KAAK,4DAA4D,sCAAsC,EAAE,+CAA+C,uBAAuB,uBAAuB,oCAAoC,GAAG,sBAAsB,yBAAyB,MAAM,sBAAsB,sBAAsB,cAAc,MAAM,sBAAsB,sBAAsB,qB\\",\\"file\\":\\"main.js\\",\\"sourcesContent\\":[\\"var cov_1v2zerd2hz=function(){var path=\\\\\\"/fixtures/basic.js\\\\\\",hash=\\\\\\"f67bc5731c59e70932ca6e13967f6329cc8682d3\\\\\\",global=new Function('return this')(),gcv=\\\\\\"__coverage__\\\\\\",coverageData={path:\\\\\\"/fixtures/basic.js\\\\\\",statementMap:{\\\\\\"0\\\\\\":{start:{line:1,column:0},end:{line:11,column:2}},\\\\\\"1\\\\\\":{start:{line:4,column:4},end:{line:4,column:18}},\\\\\\"2\\\\\\":{start:{line:8,column:4},end:{line:8,column:23}}},fnMap:{\\\\\\"0\\\\\\":{name:\\\\\\"(anonymous_0)\\\\\\",decl:{start:{line:3,column:2},end:{line:3,column:3}},loc:{start:{line:3,column:8},end:{line:5,column:3}},line:3},\\\\\\"1\\\\\\":{name:\\\\\\"(anonymous_1)\\\\\\",decl:{start:{line:7,column:2},end:{line:7,column:3}},loc:{start:{line:7,column:8},end:{line:9,column:3}},line:7}},branchMap:{},s:{\\\\\\"0\\\\\\":0,\\\\\\"1\\\\\\":0,\\\\\\"2\\\\\\":0},f:{\\\\\\"0\\\\\\":0,\\\\\\"1\\\\\\":0},b:{},_coverageSchema:\\\\\\"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c\\\\\\"},coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}coverageData.hash=hash;return coverage[path]=coverageData;}();++cov_1v2zerd2hz.s[0];module.exports=class Foo{bar(){++cov_1v2zerd2hz.f[0];++cov_1v2zerd2hz.s[1];return!!this;}baz(){++cov_1v2zerd2hz.f[1];++cov_1v2zerd2hz.s[2];return!this.bar();}};\\\\n\\\\n\\\\n//////////////////\\\\n// WEBPACK FOOTER\\\\n// ./test/fixtures/basic.js\\\\n// module id = 0\\\\n// module chunks = 0\\"],\\"sourceRoot\\":\\"\\"}"`; +exports[`disabled sourcemaps 1`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///./test/fixtures/basic.js\\"],\\"names\\":[],\\"mappings\\":\\";;;;;AAAa,8BAA8B,oJAAoJ,wCAAwC,KAAK,OAAO,iBAAiB,MAAM,mBAAmB,MAAM,OAAO,iBAAiB,MAAM,mBAAmB,MAAM,OAAO,kBAAkB,MAAM,mBAAmB,MAAM,OAAO,kBAAkB,MAAM,mBAAmB,MAAM,OAAO,kBAAkB,MAAM,mBAAmB,MAAM,OAAO,kBAAkB,MAAM,mBAAmB,MAAM,OAAO,kBAAkB,MAAM,mBAAmB,MAAM,OAAO,kBAAkB,MAAM,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ourcesContent\\":[\\"\\\\\\"use strict\\\\\\";var cov_1v2zerd2hz=function(){var path=\\\\\\"/fixtures/basic.js\\\\\\",hash=\\\\\\"9f43b4cb30c68c93d6983a04852457a950700587\\\\\\",global=new Function('return this')(),gcv=\\\\\\"__coverage__\\\\\\",coverageData={path:\\\\\\"/fixtures/basic.js\\\\\\",statementMap:{\\\\\\"0\\\\\\":{start:{line:3,column:19},end:{line:3,column:563}},\\\\\\"1\\\\\\":{start:{line:3,column:76},end:{line:3,column:347}},\\\\\\"2\\\\\\":{start:{line:3,column:134},end:{line:3,column:142}},\\\\\\"3\\\\\\":{start:{line:3,column:144},end:{line:3,column:199}},\\\\\\"4\\\\\\":{start:{line:3,column:200},end:{line:3,column:231}},\\\\\\"5\\\\\\":{start:{line:3,column:232},end:{line:3,column:286}},\\\\\\"6\\\\\\":{start:{line:3,column:259},end:{line:3,column:286}},\\\\\\"7\\\\\\":{start:{line:3,column:287},end:{line:3,column:345}},\\\\\\"8\\\\\\":{start:{line:3,column:350},end:{line:3,column:559}},\\\\\\"9\\\\\\":{start:{line:3,column:407},end:{line:3,column:475}},\\\\\\"10\\\\\\":{start:{line:3,column:423},end:{line:3,column:475}},\\\\\\"11\\\\\\":{start:{line:3,column:476},end:{line:3,column:536}},\\\\\\"12\\\\\\":{start:{line:3,column:493},end:{line:3,column:536}},\\\\\\"13\\\\\\":{start:{line:3,column:537},end:{line:3,column:556}},\\\\\\"14\\\\\\":{start:{line:5,column:50},end:{line:5,column:151}},\\\\\\"15\\\\\\":{start:{line:5,column:92},end:{line:5,column:149}},\\\\\\"16\\\\\\":{start:{line:7,column:0},end:{line:20,column:4}},\\\\\\"17\\\\\\":{start:{line:9,column:4},end:{line:9,column:31}},\\\\\\"18\\\\\\":{start:{line:12,column:2},end:{line:17,column:6}},\\\\\\"19\\\\\\":{start:{line:15,column:6},end:{line:15,column:20}},\\\\\\"20\\\\\\":{start:{line:19,column:2},end:{line:19,column:13}}},fnMap:{\\\\\\"0\\\\\\":{name:\\\\\\"(anonymous_0)\\\\\\",decl:{start:{line:3,column:19},end:{line:3,column:20}},loc:{start:{line:3,column:31},end:{line:3,column:561}},line:3},\\\\\\"1\\\\\\":{name:\\\\\\"defineProperties\\\\\\",decl:{start:{line:3,column:42},end:{line:3,column:58}},loc:{start:{line:3,column:74},end:{line:3,column:349}},line:3},\\\\\\"2\\\\\\":{name:\\\\\\"(anonymous_2)\\\\\\",decl:{start:{line:3,column:357},end:{line:3,column:358}},loc:{start:{line:3,column:405},end:{line:3,column:558}},line:3},\\\\\\"3\\\\\\":{name:\\\\\\"_classCallCheck\\\\\\",decl:{start:{line:5,column:9},end:{line:5,column:24}},loc:{start:{line:5,column:48},end:{line:5,column:153}},line:5},\\\\\\"4\\\\\\":{name:\\\\\\"(anonymous_4)\\\\\\",decl:{start:{line:7,column:17},end:{line:7,column:18}},loc:{start:{line:7,column:29},end:{line:20,column:1}},line:7},\\\\\\"5\\\\\\":{name:\\\\\\"Foo\\\\\\",decl:{start:{line:8,column:11},end:{line:8,column:14}},loc:{start:{line:8,column:17},end:{line:10,column:3}},line:8},\\\\\\"6\\\\\\":{name:\\\\\\"bar\\\\\\",decl:{start:{line:14,column:20},end:{line:14,column:23}},loc:{start:{line:14,column:26},end:{line:16,column:5}},line:14}},branchMap:{\\\\\\"0\\\\\\":{loc:{start:{line:3,column:168},end:{line:3,column:198}},type:\\\\\\"binary-expr\\\\\\",locations:[{start:{line:3,column:168},end:{line:3,column:189}},{start:{line:3,column:193},end:{line:3,column:198}}],line:3},\\\\\\"1\\\\\\":{loc:{start:{line:3,column:232},end:{line:3,column:286}},type:\\\\\\"if\\\\\\",locations:[{start:{line:3,column:232},end:{line:3,column:286}},{start:{line:3,column:232},end:{line:3,column:286}}],line:3},\\\\\\"2\\\\\\":{loc:{start:{line:3,column:407},end:{line:3,column:475}},type:\\\\\\"if\\\\\\",locations:[{start:{line:3,column:407},end:{line:3,column:475}},{start:{line:3,column:407},end:{line:3,column:475}}],line:3},\\\\\\"3\\\\\\":{loc:{start:{line:3,column:476},end:{line:3,column:536}},type:\\\\\\"if\\\\\\",locations:[{start:{line:3,column:476},end:{line:3,column:536}},{start:{line:3,column:476},end:{line:3,column:536}}],line:3},\\\\\\"4\\\\\\":{loc:{start:{line:5,column:50},end:{line:5,column:151}},type:\\\\\\"if\\\\\\",locations:[{start:{line:5,column:50},end:{line:5,column:151}},{start:{line:5,column:50},end:{line:5,column:151}}],line:5}},s:{\\\\\\"0\\\\\\":0,\\\\\\"1\\\\\\":0,\\\\\\"2\\\\\\":0,\\\\\\"3\\\\\\":0,\\\\\\"4\\\\\\":0,\\\\\\"5\\\\\\":0,\\\\\\"6\\\\\\":0,\\\\\\"7\\\\\\":0,\\\\\\"8\\\\\\":0,\\\\\\"9\\\\\\":0,\\\\\\"10\\\\\\":0,\\\\\\"11\\\\\\":0,\\\\\\"12\\\\\\":0,\\\\\\"13\\\\\\":0,\\\\\\"14\\\\\\":0,\\\\\\"15\\\\\\":0,\\\\\\"16\\\\\\":0,\\\\\\"17\\\\\\":0,\\\\\\"18\\\\\\":0,\\\\\\"19\\\\\\":0,\\\\\\"20\\\\\\":0},f:{\\\\\\"0\\\\\\":0,\\\\\\"1\\\\\\":0,\\\\\\"2\\\\\\":0,\\\\\\"3\\\\\\":0,\\\\\\"4\\\\\\":0,\\\\\\"5\\\\\\":0,\\\\\\"6\\\\\\":0},b:{\\\\\\"0\\\\\\":[0,0],\\\\\\"1\\\\\\":[0,0],\\\\\\"2\\\\\\":[0,0],\\\\\\"3\\\\\\":[0,0],\\\\\\"4\\\\\\":[0,0]},inputSourceMap:{version:3,sources:[\\\\\\"test/fixtures/basic.js\\\\\\"],names:[\\\\\\"module\\\\\\",\\\\\\"exports\\\\\\"],mappings:\\\\\\";;;;;;AAAAA,OAAOC,OAAP;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,0BAEQ;AACJ,aAAO,CAAC,CAAC,IAAT;AACD;AAJH;;AAAA;AAAA\\\\\\",file:\\\\\\"basic.js\\\\\\",sourceRoot:\\\\\\"\\\\\\",sourcesContent:[\\\\\\"module.exports = class Foo {\\\\\\\\n\\\\\\\\n bar() {\\\\\\\\n return !!this;\\\\\\\\n }\\\\\\\\n\\\\\\\\n};\\\\\\\\n\\\\\\"]},_coverageSchema:\\\\\\"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c\\\\\\"},coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}coverageData.hash=hash;return coverage[path]=coverageData;}();var _createClass=(++cov_1v2zerd2hz.s[0],function(){++cov_1v2zerd2hz.f[0];function defineProperties(target,props){++cov_1v2zerd2hz.f[1];++cov_1v2zerd2hz.s[1];for(var i=0;i { test('sourcemap files on by default', async () => { const stats = await webpack({ extend: { - devtool: 'sourcemap', + devtool: 'source-map', }, }); const sourceMap = stats.compilation.assets['main.js.map'].source(); @@ -21,7 +21,7 @@ test('sourcemap files on by default', async () => { test('disabled sourcemaps', async () => { const stats = await webpack({ extend: { - devtool: 'sourcemap', + devtool: 'source-map', }, options: { produceSourceMap: false, diff --git a/test/utils/loader.js b/test/utils/loader.js index ec2354a..fa61043 100644 --- a/test/utils/loader.js +++ b/test/utils/loader.js @@ -1,11 +1,18 @@ import path from 'path'; import loader from '../../src/cjs'; -module.exports = function (...args) { +const normalize = str => str.split(path.sep).join('/'); + +module.exports = function (source, map, ...args) { // hack the resourcePath to be consistent across systems so that tests always work - this.resourcePath = this.resourcePath - .replace(path.resolve(__dirname, '..'), '') - // make windows paths appear like unix - .replace(/\\/g, '/'); - return loader.call(this, ...args); + this.resourcePath = normalize(this.resourcePath.replace(path.resolve(__dirname, '..'), '')); + + // do the same hack for sourcemaps so tests are consistent + const sourceMap = map; + if (sourceMap) { + sourceMap.sourceRoot = ''; + sourceMap.sources = sourceMap.sources.map(normalize); + } + + return loader.call(this, source, sourceMap, ...args); }; diff --git a/test/utils/webpack.js b/test/utils/webpack.js index f43cc0a..cab504d 100644 --- a/test/utils/webpack.js +++ b/test/utils/webpack.js @@ -12,6 +12,9 @@ export default function ({ fixture = 'basic.js', options, extend = {} } = {}) { }, module: { rules: [{ + test: /\.js$/, + loader: 'babel-loader', + }, { test: /\.js$/, loader, enforce: 'post',