Investigate why {ee/,}spec/frontend/work_items/list/components/work_items_list_app_spec.js throws error after test environment was torn down with vue@3

Steps to investigate:

  1. VUE_VERSION=3 yarn run jest {ee/,}spec/frontend/work_items/list/components/work_items_list_app_spec.js --no-skip-vue3

Example job:

 PASS  spec/frontend/work_items/list/components/work_items_list_app_spec.js (808 MB heap size)
ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From ee/spec/frontend/work_items/list/components/work_items_list_app_spec.js.
      17 |   new Promise(setImmediate).then(() => {
      18 |     // wait for pending setTimeout()s
    > 19 |     jest.runOnlyPendingTimers();
         |          ^
      20 |   }),
      21 | );
      22 |
      at runOnlyPendingTimers (spec/frontend/test_setup.js:19:10)
 FAIL  ee/spec/frontend/work_items/list/components/work_items_list_app_spec.js
  ● Test suite failed to run
    Unhandled Promise rejections: Error: Caught error after test environment was torn down
    Cannot call vm on an empty VueWrapper.
      at tearDownEnv (node_modules/jest-runner/build/runTest.js:286:7)
Edited by Mark Florian