From e079dd2a4278f4639e863e9bb90e7b15b21e13b9 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Mon, 5 Dec 2022 09:36:41 +0100 Subject: [PATCH] fix: Map lines for script block Signed-off-by: Wolfgang Walther --- e2e/2.x/basic/__snapshots__/test.js.snap | 43 +++++++++++++++--------- packages/vue2-jest/lib/process.js | 1 + 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/e2e/2.x/basic/__snapshots__/test.js.snap b/e2e/2.x/basic/__snapshots__/test.js.snap index 018258ad..f8f9c647 100644 --- a/e2e/2.x/basic/__snapshots__/test.js.snap +++ b/e2e/2.x/basic/__snapshots__/test.js.snap @@ -3,25 +3,35 @@ exports[`generates source maps for .vue files 1`] = ` { "file": "./components/Basic.vue", - "mappings": ";;;;;;eACe;AACbA,MAAI,EAAE,OADO;AAEbC,UAAQ,EAAE;AACRC,kBAAc,EAAE,SAASA,cAAT,GAA0B;AACxC,aAAO;AACLC,WAAG,EAAE,KAAKC,OADL;AAELC,YAAI,EAAE,CAAC,KAAKD,OAFP;AAGLE,cAAM,EAAE,KAAKF;AAHR,OAAP;AAKD;AAPO,GAFG;AAWbG,MAAI,EAAE,SAASA,IAAT,GAAgB;AACpB,WAAO;AACLC,SAAG,EAAE,4BADA;AAELJ,aAAO,EAAE;AAFJ,KAAP;AAID,GAhBY;AAiBbK,SAAO,EAAE;AACPC,eAAW,EAAE,SAASA,WAAT,GAAuB;AAClC,WAAKN,OAAL,GAAe,CAAC,KAAKA,OAArB;AACD;AAHM;AAjBI,C", - "names": [ - "name", - "computed", - "headingClasses", - "red", - "isCrazy", - "blue", - "shadow", - "data", - "msg", - "methods", - "toggleClass", - ], + "mappings": ";;;;;;eAuBe;AACb,MAAI,EAAE,OADO;AAEb,UAAQ,EAAE;AACR,kBAAc,EAAE,SAAS,cAAT,GAA0B;AACxC,aAAO;AACL,WAAG,EAAE,KAAK,OADL;AAEL,YAAI,EAAE,CAAC,KAAK,OAFP;AAGL,cAAM,EAAE,KAAK;AAHR,OAAP;AAKD;AAPO,GAFG;AAWb,MAAI,EAAE,SAAS,IAAT,GAAgB;AACpB,WAAO;AACL,SAAG,EAAE,4BADA;AAEL,aAAO,EAAE;AAFJ,KAAP;AAID,GAhBY;AAiBb,SAAO,EAAE;AACP,eAAW,EAAE,SAAS,WAAT,GAAuB;AAClC,WAAK,OAAL,GAAe,CAAC,KAAK,OAArB;AACD;AAHM;AAjBI", + "names": [], "sources": [ - "Basic.vue", + "components/Basic.vue", ], "sourcesContent": [ - " + " + + + + + + ", ], "version": 3, diff --git a/packages/vue2-jest/lib/process.js b/packages/vue2-jest/lib/process.js index ebcdfdd8..cbb63b3a 100644 --- a/packages/vue2-jest/lib/process.js +++ b/packages/vue2-jest/lib/process.js @@ -48,6 +48,7 @@ function processScript(scriptPart, filePath, config) { const result = transformer.process(scriptPart.content, filePath, config) result.code = stripInlineSourceMap(result.code) + result.map = mapLines(scriptPart.map, result.map) result.externalSrc = externalSrc return result }