[Vuejs]-Changes to Vue components do not trigger Jest to rerun

0👍

The fix I figured out is to do with Jest’s configuration. Here is the addition of moduleFileExtensions to the Jest configuration in my package.json file:

{
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "vue"
    ],
    "transform": {
      "^.+\\.js$": "babel-jest",
      "^.+\\.vue$": "vue-jest"
    }
  }
}

Then I started unit test in the watch mode:

npm run test:unit -- --watchAll 

Now whenever I make any change to my Vue components, Jest will rerun the unit tests as expected.

Hope it helps.

Leave a comment