Vue-cli: yarn test:unit --watch outputs a configuration error while yarn test:unit & yarn test:unit --watchAll don't

Created on 5 Sep 2018  路  6Comments  路  Source: vuejs/vue-cli

Version

3.0.1

Reproduction link

https://github.com/Hebilicious/jest-watchbug

Node and OS info

Node: 10.5.0 / yarn 1.9.4 / Ubuntu 18.04.1 LTS

Steps to reproduce

You might have to modify App.vue if you get this message "No tests found related to files changed since last commit."

yarn
yarn test:unit 
yarn test:unit --watch

What is expected?

Jest --watch mode should not issue errors if the test suite passes.

What is actually happening?

The output is the following error :

Configuration error:

Could not locate module @/assets/${this.logo} mapped as:
/home/hebilicious/jest-watchbug/src/assets/${this.logo} 

Please check your configuration for these entries:
{
  "moduleNameMapper": {
    "/^@\/(.*)$/": "/home/hebilicious/Code/jest-watchbug/src/$1"
  },
  "resolver": null
}

yarn test:unit --watchAll works for some reasons, so this is not urgent... still I do not know if the 'bug' comes from vue-cli, vue-jest, babel-jest, or jest itself.

Most helpful comment

+1, same problem --watch fails, but --watchAll works

All 6 comments

I get this too on --watch. The "Could not locate module" error points at a module that is not even in my repo directory but is in a sibling repo directory. This is with the default Vue CLI Jest installation.

+1

This seems to be reproducible in npm as well when running npm run test:unit -- --watch, as is exhibited by this project. It seems related to the jest configuration, however, and not directly to vue-cli.

+1, same problem --watch fails, but --watchAll works

+1

Anybody has found a solution?

Thanks!

Was this page helpful?
0 / 5 - 0 ratings