Skip to content

Commit

Permalink
fix: Map lines for script block (#516)
Browse files Browse the repository at this point in the history
Signed-off-by: Wolfgang Walther <walther@technowledgy.de>

Signed-off-by: Wolfgang Walther <walther@technowledgy.de>
  • Loading branch information
wolfgangwalther committed Dec 11, 2022
1 parent dbe8022 commit 33daf44
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
43 changes: 27 additions & 16 deletions e2e/2.x/basic/__snapshots__/test.js.snap
Expand Up @@ -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": [
"
"<template>
<div class="hello">
<h1 :class="headingClasses">{{ msg }}</h1>
</div>
</template>
<style module="css">
.testA {
background-color: red;
}
</style>
<style module>
.testB {
background-color: blue;
}
</style>
<style>
.testC {
background-color: blue;
}
</style>
<script>
export default {
name: 'basic',
computed: {
Expand All @@ -45,6 +55,7 @@ export default {
}
}
}
</script>
",
],
"version": 3,
Expand Down
1 change: 1 addition & 0 deletions packages/vue2-jest/lib/process.js
Expand Up @@ -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
}
Expand Down

0 comments on commit 33daf44

Please sign in to comment.