20

I got an error and I need your help. Thank for watching this question.

My situation: I am configuring Drone CI tool for my project and I get this when I run unit test on drone.yml.

Validation Error:

  Module <rootDir>/node_modules/vue-jest in the transform option was not found.

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html

Here is my jest.conf.js

transform: {
    "^.+\\.js$": "babel-jest",
    ".*\\.vue$": "<rootDir>/node_modules/vue-jest"
  },

What I have tried:

  1. Remove <rootDir>/node_modules/. But I got an another error Module vue-jest in the transform option was not found.. So I think it is not the right solution
skyboyer
  • 22,209
  • 7
  • 57
  • 64
Hoang Subin
  • 6,610
  • 6
  • 37
  • 56

2 Answers2

11
npm install --save-dev vue-jest

and rerun your test

Artsiom Lamaka
  • 119
  • 1
  • 4
9

Take a note that vue-jest is currently (2022) distributed in 3 concurrent packages:

  • vue-jest
  • @vue/vue2-jest
  • @vue/vue3-jest

In my case I've upgraded some dependencies and I had to switch from vue-jest to @vue/vue3-jest.

So my jest.config.js has to change accordingly:

module.exports = {
...
  transform: {
    "^.+\\.vue$": "@vue/vue3-jest",
  },
...
}
Qback
  • 4,310
  • 3
  • 25
  • 38