vue test utils TypeError: Cannot destructure property `config` of 'undefined' or 'null'

The package is moving away from semantic versioning to support a variety of Vue versions (2.x, 3.x) and Jest versions (26.x, 27.x). So, if you're using Vue 3.x and Jest 27.x, you need to install vue3-jest, not vue-jest.

npm i vue3-jest -D

# or

yarn add vue3-jest --dev

Then, update your jest.config.js as follows:

module.exports = {
  moduleFileExtensions: ['vue', 'js', 'json', 'jsx'],
  testEnvironment: 'jsdom',
  transform: {
    '^.+\\.vue$': 'vue3-jest',
    '^.+\\js$': 'babel-jest',
  },
}

By the time of writing this answer, the package naming & versioning was like so:

enter image description here

You can read more about the new naming & versioning strategy here.


If you're using version 27 of jest, try downgrading to version 26. Make sure to downgrade babel-jest and ts-jest as well to version 26. I was getting the following error and that did it for me:

Cannot destructure property 'config' of 'undefined' as it is undefined.