From 06d6cea725625b0a20bcb0c58863f8d7de8e0c8d Mon Sep 17 00:00:00 2001 From: Kirill Zaytsev Date: Sun, 22 May 2022 17:59:59 +0300 Subject: [PATCH] fix: Less relative path in imports --- e2e/2.x/style/components/Less.vue | 11 ++++++++++- e2e/2.x/style/components/styles/less-a.less | 7 +++++++ packages/vue2-jest/lib/process-style.js | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 e2e/2.x/style/components/styles/less-a.less diff --git a/e2e/2.x/style/components/Less.vue b/e2e/2.x/style/components/Less.vue index 2731b5dc..3e94f459 100644 --- a/e2e/2.x/style/components/Less.vue +++ b/e2e/2.x/style/components/Less.vue @@ -1,9 +1,18 @@ diff --git a/e2e/2.x/style/components/styles/less-a.less b/e2e/2.x/style/components/styles/less-a.less new file mode 100644 index 00000000..6b45a74c --- /dev/null +++ b/e2e/2.x/style/components/styles/less-a.less @@ -0,0 +1,7 @@ +@import "variables"; +.c { + color: @primary-color; +} +.d { + background-color: @primary-color; +} diff --git a/packages/vue2-jest/lib/process-style.js b/packages/vue2-jest/lib/process-style.js index 95f32446..538705ba 100644 --- a/packages/vue2-jest/lib/process-style.js +++ b/packages/vue2-jest/lib/process-style.js @@ -45,7 +45,7 @@ function getPreprocessOptions(lang, filePath, jestConfig) { }) } } - if (lang === 'styl' || lang === 'stylus') { + if (lang === 'styl' || lang === 'stylus' || lang === 'less') { return { paths: [path.dirname(filePath), process.cwd()] }