vue-jest icon indicating copy to clipboard operation
vue-jest copied to clipboard

TypeError: Cannot read properties of undefined (reading 'getCacheKey')

Open MarkTallentire opened this issue 3 years ago • 3 comments

My package.json:

 "devDependencies": {
    "@babel/eslint-parser": "^7.13.14",
    "@quasar/app": "^3.2.9",
    "@quasar/quasar-app-extension-testing": "^2.0.2",
    "@quasar/quasar-app-extension-testing-e2e-cypress": "^4.0.0-beta.9",
    "@quasar/quasar-app-extension-testing-unit-jest": "^3.0.0-alpha.8",
    "@testing-library/dom": "^8.11.1",
    "@testing-library/user-event": "^13.5.0",
    "@testing-library/vue": "^6.4.2",
    "@types/node": "^12.20.21",
    "@typescript-eslint/eslint-plugin": "^4.16.1",
    "@typescript-eslint/parser": "^4.16.1",
    "@vue/vue3-jest": "^27.0.0-alpha.3",
    "babel-core": "^7.0.0-bridge.0",
    "concurrently": "^6.3.0",
    "electron": "^16.0.6",
    "eslint": "^7.14.0",
    "eslint-config-prettier": "^8.1.0",
    "eslint-plugin-cypress": "^2.11.3",
    "eslint-plugin-jest": "^25.2.2",
    "eslint-plugin-vue": "^7.0.0",
    "jest": "^27.4.7",
    "jest-cli": "^27.4.7",
    "majestic": "^1.7.0",
    "ts-jest": "^27.1.3"
  },

Error thrown: TypeError: Cannot read properties of undefined (reading 'getCacheKey')

Unsure if this is because Jest 27 is still not fully supported?

MarkTallentire avatar Jan 26 '22 13:01 MarkTallentire

I'm facing the same issue with @vue/vue2-jest on Vue 2. I think they need to update the following line

node_modules/@vue/vue2-jest/lib/index.js

const babelJest = require('babel-jest').default // Returns undefined

christianlmc avatar Jan 28 '22 15:01 christianlmc

Faced this error when trying to collect test coverage. Installing babel-jest": "^27.5.1" fixed this for me.

littlejon85 avatar Feb 11 '22 10:02 littlejon85

New version patch has solved this questions. If use vue3, need to use these version could solve it.

{
    "babel-jest": "^29.0.2",
    "jest": "^29.0.2",
    "jest-environment-jsdom": "^29.0.2",
    "jest-environment-node": "^29.0.2",
   "ts-jest": "^28.0.8",
    "@vue/vue3-jest": "^29.0.0"
}

fwx5618177 avatar Sep 05 '22 02:09 fwx5618177