quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.97k stars 3.53k forks source link

Unhandeled error in QDialog while testing in CI #15581

Closed mobsean closed 1 year ago

mobsean commented 1 year ago

What happened?

While unit testing with vitest this unhandeled error apprears very unregualary.

⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
⎯⎯⎯⎯⎯ Uncaught Exception ⎯⎯⎯⎯⎯
TypeError: Cannot read properties of undefined (reading 'includes')
 ❯ Function.getSelectorParts node_modules/happy-dom/src/query-selector/QuerySelector.ts:233:38
 ❯ Function.querySelector node_modules/happy-dom/src/query-selector/QuerySelector.ts:46:28
 ❯ HTMLElement.querySelector node_modules/happy-dom/src/nodes/element/Element.ts:812:24
 ❯ Array.<anonymous> node_modules/quasar/src/components/dialog/QDialog.js:259:40
    260|       }
    261| 
    262|       emit('shake')
       |               ^
    263| 
    264|       const node = innerRef.value
 ❯ Module.removeFocusWaitFlag node_modules/quasar/src/utils/private/focus-manager.js:19:30
 ❯ showPortal node_modules/quasar/src/composables/private/use-portal.js:59:29
 ❯ Timeout._onTimeout node_modules/quasar/src/components/dialog/QDialog.js:222:9
 ❯ listOnTimeout node:internal/timers:559:17
 ❯ processTimers node:internal/timers:502:7
This error originated in "test/vitest/__tests__/myTest.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Test still passes though.

What did you expect to happen?

no unhandled errors

Reproduction URL

https://codepen.io/rstoenescu/pen/xxEvBLr

How to reproduce?

Since this only happens in rare cases I´m not able to reproduce it with certanty.

I would restart the CI and the tests will pass without the error. So I´m assuming there is a race condition/ timing issue somewhere.

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Components (quasar)

Platforms/Browsers

No response

Quasar info output

Operating System - Windows_NT(10.0.19045) - win32/x64
NodeJs - 18.14.0

Global packages
  NPM - 9.3.1
  yarn - Not installed
  @quasar/cli - 1.3.2
  @quasar/icongenie - Not installed
  cordova - Not installed

Important local packages
  quasar - 2.11.7 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app-vite - 1.2.1 -- Quasar Framework App CLI with Vite
  @quasar/extras - 1.15.11 -- Quasar Framework fonts, icons and animations
  eslint-plugin-quasar - Not installed
  vue - 3.2.47 -- The progressive JavaScript framework for building modern web UI.
  vue-router - 4.1.6
  pinia - 2.0.33 -- Intuitive, type safe and flexible Store for Vue
  vuex - Not installed
  vite - 2.9.15 -- Native-ESM powered web dev build tool
  eslint - 8.36.0 -- An AST-based pattern checker for JavaScript.
  electron - Not installed
  electron-packager - Not installed
  electron-builder - Not installed
  register-service-worker - 1.7.2 -- Script for registering service worker, with hooks
  @capacitor/core - Not installed
  @capacitor/cli - Not installed
  @capacitor/android - Not installed
  @capacitor/ios - Not installed

Quasar App Extensions
  @quasar/quasar-app-extension-testing-unit-vitest - 0.2.1 -- A Quasar App Extension for running tests with Vitest

Networking
yes

Relevant log output

⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
⎯⎯⎯⎯⎯ Uncaught Exception ⎯⎯⎯⎯⎯
TypeError: Cannot read properties of undefined (reading 'includes')
 ❯ Function.getSelectorParts node_modules/happy-dom/src/query-selector/QuerySelector.ts:233:38
 ❯ Function.querySelector node_modules/happy-dom/src/query-selector/QuerySelector.ts:46:28
 ❯ HTMLElement.querySelector node_modules/happy-dom/src/nodes/element/Element.ts:812:24
 ❯ Array.<anonymous> node_modules/quasar/src/components/dialog/QDialog.js:259:40
    260|       }
    261| 
    262|       emit('shake')
       |               ^
    263| 
    264|       const node = innerRef.value
 ❯ Module.removeFocusWaitFlag node_modules/quasar/src/utils/private/focus-manager.js:19:30
 ❯ showPortal node_modules/quasar/src/composables/private/use-portal.js:59:29
 ❯ Timeout._onTimeout node_modules/quasar/src/components/dialog/QDialog.js:222:9
 ❯ listOnTimeout node:internal/timers:559:17
 ❯ processTimers node:internal/timers:502:7
This error originated in "test/vitest/__tests__/myTest.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Additional context

While running vitest in CI

yusufkandemir commented 1 year ago

You didn't provide a reproduction or any code. So, it's not possible to process this issue. Please provide a reproduction as the issue form prompted you to do so while creating the issue. Do not post random links to pass the requirements as that won't change anything.