Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of warnings & errors when running unit tests #6337

Closed
pascalwengerter opened this issue Jan 29, 2022 · 18 comments · Fixed by #6421, #6525, #6862, #7057 or #7440
Closed

Lots of warnings & errors when running unit tests #6337

pascalwengerter opened this issue Jan 29, 2022 · 18 comments · Fixed by #6421, #6525, #6862, #7057 or #7440

Comments

@pascalwengerter
Copy link
Contributor

Expected behaviour

(Successful) Unit test runs provide minimal output to console

Actual behaviour

(Successful) Unit test runs spam the console with warnings & errors

Hints

Especially the tests in packages/web-app-files/tests/unit/views/ seem to be offenders

@pascalwengerter
Copy link
Contributor Author

@individual-it could your team take a look in the upcoming weeks?

@phil-davis
Copy link
Contributor

I added to the Test Automation Backlog project. We will put it in a test automation sprint.

@kulmann
Copy link
Member

kulmann commented Jan 31, 2022

Related to this: #6130 (error messages like that should never be part of the html).

@kulmann
Copy link
Member

kulmann commented Feb 9, 2022

I'd like to raise the prio on this. It's becoming quite hard meanwhile to identify actual test failures vs "noise" when running unit tests locally and having something failing. Would be good to get ahead of this again.

@individual-it individual-it added QA:p2 and removed QA:p3 labels Feb 9, 2022
@individual-it individual-it self-assigned this Feb 9, 2022
@individual-it
Copy link
Member

added it to the current sprint and assigned myselg, could be as simple as adding --silent to yest

@pascalwengerter
Copy link
Contributor Author

added it to the current sprint and assigned myselg, could be as simple as adding --silent to jest

While adding the --silent option may improve things, those errors both hint towards problematic parts in both the test code and our actual components/helpers so I'd prefer if you have a good look at the logs before "just muting them" 😇

@phil-davis
Copy link
Contributor

Agree ^ - fix/refactor anything that is actually "dodgy"

@individual-it
Copy link
Member

So I misunderstood what the task is about
I've created now a couple PRs with some easy fixes - mostly pinging those who have worked last/initially on them to review. But of-course everybody please feel free to review.

What I could not solve so far:

  • mocking elements with v-translate [tests-only] remove language related log outputs in unit-tests #6404 (review)
  • finding out from which test these kind of messages come, the error output seems not to be related to the test run output
    node:internal/process/promises:265
             triggerUncaughtException(err, true /* fromPromise */);
             ^
    
     [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "TypeError: router.replace is not a function".] {
      code: 'ERR_UNHANDLED_REJECTION'
    }
    

any ideas on those issues?

@individual-it
Copy link
Member

some tests are completely kaput e.g. packages/web-app-files/tests/unit/views/Trashbin.spec.js
Trashbin was e.g. refactored here https://github.com/owncloud/web/pull/5917/files , but the tests not adjusted
CI shows errors but does not fail

(node:159) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)

(node:159) UnhandledPromiseRejectionWarning: TypeError: router.replace is not a function

if I run it locally with node 16 the test fails, with node 14 it spits out the error but marks the test as passed

@individual-it
Copy link
Member

after #6415 those tests should not pass anymore

@kulmann
Copy link
Member

kulmann commented Feb 11, 2022

wow 😍

@individual-it
Copy link
Member

reopening because there is a new error
grafik

@individual-it
Copy link
Member

reopening because seeing this in nightly builds:

PASS packages/web-app-files/tests/unit/components/SideBar/Shares/FileShares.spec.js (16.156 s)
  ● Console
    console.error
      [Vue warn]: The setup binding property "sharesLoading" is already declared.

      found in
      ---> <FileShares>
             <Root>
PASS packages/web-app-files/tests/unit/components/SideBar/Details/FileDetails.spec.js
  ● Console
    console.error
      [Vue warn]: Unknown custom element: <oc-status-indicators> - did you register the component correctly? For recursive components, make sure to provide the "name" option.      

      found in

      ---> <FileDetails>
             <Root>
PASS packages/web-app-files/tests/unit/components/AppBar/SharesNavigation.spec.js
  ● Console
    console.warn
      [vue-router] Route with name 'files-shares-with-me' does not exist

      22 |   return comparatives
      23 |     .map((comparative) => {
    > 24 |       const { href: comparativeHref } = router.resolve({
         |                                                ^
      25 |         ...comparative
      26 |         // ...(comparative.name && { name: resolveRouteName(comparative.name) })
      27 |       })
......

    console.warn
      [vue-router] Route with name 'files-shares-with-others' does not exist

      22 |   return comparatives
      23 |     .map((comparative) => {
    > 24 |       const { href: comparativeHref } = router.resolve({
         |                                                ^
      25 |         ...comparative
      26 |         // ...(comparative.name && { name: resolveRouteName(comparative.name) })
      27 |       })

.......

    console.warn
      [vue-router] Route with name 'files-shares-via-link' does not exist

      22 |   return comparatives
      23 |     .map((comparative) => {
    > 24 |       const { href: comparativeHref } = router.resolve({
         |                                                ^
      25 |         ...comparative
      26 |         // ...(comparative.name && { name: resolveRouteName(comparative.name) })
      27 |       })

@individual-it
Copy link
Member

for now this should be fixed after #6732 & #6733 get merged

@kulmann
Copy link
Member

kulmann commented Apr 5, 2022

Thanks for taking care! Closing now, since I merged your two PRs.

@kulmann kulmann closed this as completed Apr 5, 2022
@individual-it
Copy link
Member

reopening because seeing this in nightly builds:

PASS packages/web-runtime/tests/unit/components/Topbar/FeedbackLink.spec.js
  ● Console

    console.error
      Error: Error: connect ECONNREFUSED 127.0.0.1:80
          at Object.dispatchError (/var/www/owncloud/web/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:63:19)
          at Request.<anonymous> (/var/www/owncloud/web/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:655:18)
          at Request.emit (events.js:412:35)
          at ClientRequest.<anonymous> (/var/www/owncloud/web/node_modules/jsdom/lib/jsdom/living/helpers/http-request.js:121:14)
          at ClientRequest.emit (events.js:400:28)
          at Socket.socketErrorListener (_http_client.js:475:9)
          at Socket.emit (events.js:400:28)
          at emitErrorNT (internal/streams/destroy.js:106:8)
          at emitErrorCloseNT (internal/streams/destroy.js:74:3)
          at processTicksAndRejections (internal/process/task_queues.js:82:21) undefined

      at VirtualConsole.<anonymous> (node_modules/jsdom/lib/jsdom/virtual-console.js:29:45)
      at Object.dispatchError (node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:66:53)
      at Request.<anonymous> (node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:655:18)
      at ClientRequest.<anonymous> (node_modules/jsdom/lib/jsdom/living/helpers/http-request.js:121:14)

@individual-it
Copy link
Member

reopening again, because log output came back, mostly share jail
see https://drone.owncloud.com/owncloud/web/25449/8/6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment