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

Fix problem with Jest and .vue files for lint-stage #182

Closed EgorFront closed 4 years ago

EgorFront commented 4 years ago

The problem: https://github.com/chrisvfritz/vue-enterprise-boilerplate/issues/179

In the configuration jest.config.js the moduleFileExtensions field does not contain .vue extensions. Because of this, when you run yarn test:unit:file path/to/component.vue Jest did not find the test file associated with the component. So same, under commit only .Vue component without changes associated with it the test file, Jest did not run the test

module.exports = {
  ...
  moduleFileExtensions: ['js', 'json'],
}

The solution: Add .vue extension to moduleFileExtensions

module.exports = {
  ...
  moduleFileExtensions: ['js', 'json', 'vue'],
}