bencodezen / vue-enterprise-boilerplate

An ever-evolving, very opinionated architecture and dev environment for new Vue SPA projects using Vue CLI.
7.77k stars 1.32k forks source link

'yarn test' failed on freshly cloned repo. #144

Closed alocus closed 5 years ago

alocus commented 5 years ago

Thanks for this great boilerplate. I am new to it and decided to check it out.

'yarn test' has 17 failed test cases. And I am assuming that could be some setting related to webpack or alias, but I can't figure it out. Please advice.

# Steps to reproduce my observation
git clone git@github.com:chrisvfritz/vue-enterprise-boilerplate.git
cd vue-enterprise-boilerplate
yarn
node _start.js
rm _start.js
yarn install

# dev server work, as I can login using admin/password
yarn dev   

# 12 testcases pass via browser
yarn dev:e2e

#  Expecting all test cases to pass, but vue-jest reported.
yarn test

Test Suites: 17 failed, 1 passed, 18 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        11.685s
--

// Expecting all test cases to pass on unit test.
yarn test:unit

Test Suites: 13 failed, 5 passed, 18 total
Tests:       19 passed, 19 total
Snapshots:   0 total
Time:        10.12s
Ran all test suites.
--
# My node and yarn version
$ node -v  v10.15.3
--

$ yarn -v    1.15.2
--
OS Name Microsoft Windows 10 Pro for Workstations
Version 10.0.16299 Build 16299

Not sure if it matters, but I tried on 'cmd' as well as 'git bash'
All have the same issue related to vue-jest

[vue-jest]: There was an error rendering the SCSS in [MYPATH]\vue-enterprise-boilerplate\src\components\_base-button.vue. SCSS is fully supported by vue-jest. Still some features m ight 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: [MYPATH]\vue-ent erprise-boilerplate\src\design\index.scss.
chrisvfritz commented 5 years ago

Is this still happening for you with a fresh clone? I've made some changes to the Jest config and updated some dependencies, which may have fixed the issue.

alocus commented 5 years ago

@chrisvfritz I have been getting very interesting result. I did a git pull and remove the node_modules folder to try reset my workspace.

The results of "yarn test" are not consistent, Sometimes I got 1 failed, 17 passed or 2 failed, 16 passed.

And same thing happen to "npm run test", I got different results. Nonetheless, I got one 'yarn test' with all passes out of 10+ times I ran it.

I assume it is my environment that is messed up as it seems I am the only person who has this issue.

chrisvfritz commented 5 years ago

Yes, it's very strange. 😅 It does sound like it might be some kind of environment-specific bug (probably in vue-jest). It sounds like this issue, so I'd add your case there.

It could be interesting to see if Jest's --no-cache option has any effect. And in the meantime, you can probably work around this by setting experimentalCSSCompile to false.

Since it seems likely to be a very environment-specific issue in vue-jest, I'll close this issue for now in favor of https://github.com/vuejs/vue-jest/issues/99.