vuejs / vue-jest

Jest Vue transformer
MIT License
744 stars 157 forks source link

Windows: Cannot resolve SCSS files #181

Open annam002 opened 5 years ago

annam002 commented 5 years ago

I run into this problem on Windows with vue-jest version 3.0.4: We are using SCSS styles for vue, and in the test, no styles are loaded. It works fine in production, so the problem must be somewhere in vue-jest. It also works fine on Linux.

I can reproduce this in the v3 branch of vue-jest: when I try to run the test in scss.spec.js, some tests are failing and I get the following error messages:

[vue-jest]: There was an error rendering the SCSS in D:\workspaces\vue-jest\vue-jest-3.0.4\test\resources\ScssModule.vue. SCSS is fully supported by vue-jest. Still some features might throw errors. Webpack aliases are a common cause of errors. If you use Webpack aliases, please use jest's suggested way via moduleNameMapper which is supported. [vue-jest]: Error while compiling styles: Error: File to import not found or unreadable: D:\workspaces\vue-jest\vue-jest-3.0.4\test\resources\styles\scss\D:\workspaces\vue-jest\vue-jest-3.0.4\test\resources\styles\scss\globals\global-classes-moduleNameMapper.

As you can see, the path is build up in the wrong way.

image

eddyerburgh commented 5 years ago
  1. Can you provide a GitHub repo wit a reproduction?
  2. Do you see this issue in the 4.x beta? (npm install --save-dev vue-jest@beta)
annam002 commented 5 years ago
  1. I could reproduce it by checking out the v3 branch of vue-jest and running the scss.spec.js test
annam002 commented 5 years ago
  1. I cannot get a test to run in my project with the 4.x beta version. I fails to compile the Vue template. So, not sure if the situation would be improved with this version.