vuejs / vue-jest

Jest Vue transformer
MIT License
748 stars 156 forks source link

fix: Less relative path in imports #475

Closed cmath10 closed 2 years ago

cmath10 commented 2 years ago

Hello! I noticed that this change was added only for vue3. This PR adds the same less processing as it is in vue3-jest. Without this patch, I'm catching this:

SyntaxError: undefined in input on line 334, column 1:
333 @import (reference) "../../../../../../css/less/variables.less";
334 @import (reference) "../../../../../../css/less/mixins.less";
335 

  ● Test suite failed to run

    [vue-jest] Error: Vue template compilation failed

      at error (../node_modules/@vue/vue2-jest/lib/utils.js:122:9)
      at logResultErrors (../node_modules/@vue/vue2-jest/lib/utils.js:134:5)
      at processStyle (../node_modules/@vue/vue2-jest/lib/process-style.js:104:5)
      at ../node_modules/@vue/vue2-jest/lib/process.js:87:13
          at Array.map (<anonymous>)
      at processStyle (../node_modules/@vue/vue2-jest/lib/process.js:86:6)
      at Object.module.exports [as process] (../node_modules/@vue/vue2-jest/lib/process.js:103:24)
      at ScriptTransformer.transformSource (../node_modules/@jest/transform/build/ScriptTransformer.js:612:31)
      at ScriptTransformer._transformAndBuildScript (../node_modules/@jest/transform/build/ScriptTransformer.js:758:40)
      at ScriptTransformer.transform (../node_modules/@jest/transform/build/ScriptTransformer.js:815:19)
      at Object.<anonymous> (...)
lmiller1990 commented 2 years ago

Thanks!

lmiller1990 commented 2 years ago

It's out https://github.com/vuejs/vue-jest/releases/tag/v28.1.0