In my case, the solution was that I had to install the globals package:
npm install --save-dev @jest/globals --legacy-peer-deps
I think I read somewhere that the @vue/test-utils package requires the globals package.
@vue/test-utils