1

I'm runing unit test for vue files. in the vue component i have imported ~/utility/functions file it worked in vue but while testing im getting

Cannot find module '~/utility/functions' from 'Compnent.vue' error

jest.config.js

module.exports = {
  testEnvironment: "jest-environment-jsdom",
  moduleFileExtensions: [
    "js",
    "json",
    "vue"
  ],
  modulePaths: [ "<rootDir>" ],
  moduleDirectories: [
    "node_modules", "<rootDir>"
  ],
  transform: {
    "^.+\\.js$": "babel-jest",
    "^.+\\.vue$": "@vue/vue2-jest"
  }
};

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.