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

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) when set option: "compactLogs" #39

Closed
JFRabbit opened this issue Jul 28, 2020 · 1 comment

Comments

@JFRabbit
Copy link

plugins index.js:

require("cypress-terminal-report").installPlugin(
      on,
       {
            compactLogs: 5,
       }
    );

support index.js:

require("cypress-terminal-report").installSupport(
  {
        collectTypes: [
          "cons:error",
          "cy:log",
          "cy:xhr",
          "cy:request",
          "cy:route",
          "cy:command",
        ],
  }
);

logs:

  1) foobar
       create foobar:
     AssertionError: Timed out retrying: Expected to find content: '/^key$/' within the element: [ <span>, 95 more... ] but never did.
      at eval (http://host:port/__cypress/tests?p=cypress/support/index.js:227:18)
  at Array.forEach (<anonymous>)
      at Context.createDashboard (http://host:port/__cypress/tests?p=cypress/support/index.js:224:17)

  2) foobar
       "after each" hook for "create foobar":
     CypressError: `cy.task('ctrLogMessages')` failed with the following error:

> undefined is not iterable (cannot read property Symbol(Symbol.iterator))

Because this error occurred during a `after each` hook we are skipping all of the remaining tests.
      at http://host:port/__cypress/runner/cypress_runner.js:158198:19
      at tryCatcher (http://host:port/__cypress/runner/cypress_runner.js:10130:23)
      at Promise._settlePromiseFromHandler (http://host:port/__cypress/runner/cypress_runner.js:8065:31)
      at Promise._settlePromise (http://host:port/__cypress/runner/cypress_runner.js:8122:18)
      at Promise._settlePromise0 (http://host:port/__cypress/runner/cypress_runner.js:8167:10)
      at Promise._settlePromises (http://host:port/__cypress/runner/cypress_runner.js:8243:18)
      at _drainQueueStep (http://host:port/__cypress/runner/cypress_runner.js:4837:12)
      at _drainQueue (http://host:port/__cypress/runner/cypress_runner.js:4830:9)
      at Async.../../node_modules/bluebird/js/release/async.js.Async._drainQueues (http://host:port/__cypress/runner/cypress_runner.js:4846:5)
      at Async.drainQueues (http://host:port/__cypress/runner/cypress_runner.js:4716:14)
  From Your Spec Code:
      at Context.eval (http://host:port/__cypress/tests?p=cypress/support/index.js:2975:10)
  
  From Node.js Internals:
    TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
        at /Users/jasonzhang/Documents/code/foobar/e2e/node_modules/cypress-terminal-report/src/installLogsPrinter.js:151:20
    at Array.forEach (<anonymous>)
        at logToTerminal (/Users/jasonzhang/Documents/code/foobar/e2e/node_modules/cypress-terminal-report/src/installLogsPrinter.js:151:12)
        at ctrLogMessages (/Users/jasonzhang/Documents/code/foobar/e2e/node_modules/cypress-terminal-report/src/installLogsPrinter.js:51:7)
        at invoke (/Users/jasonzhang/Library/Caches/Cypress/4.10.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/task.js:41:14)
        at /Users/jasonzhang/Library/Caches/Cypress/4.10.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:41:14
        at tryCatcher (/Users/jasonzhang/Library/Caches/Cypress/4.10.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
        at Function.Promise.attempt.Promise.try (/Users/jasonzhang/Library/Caches/Cypress/4.10.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29)
        at Object.wrapChildPromise (/Users/jasonzhang/Library/Caches/Cypress/4.10.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:40:23)
        at Object.wrap (/Users/jasonzhang/Library/Caches/Cypress/4.10.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/task.js:47:8)
        at execute (/Users/jasonzhang/Library/Caches/Cypress/4.10.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:142:12)
        at EventEmitter.<anonymous> (/Users/jasonzhang/Library/Caches/Cypress/4.10.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:235:5)
        at EventEmitter.emit (events.js:210:5)
        at process.<anonymous> (/Users/jasonzhang/Library/Caches/Cypress/4.10.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:19:22)
        at process.emit (events.js:210:5)
        at process.emit (/Users/jasonzhang/Library/Caches/Cypress/4.10.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/source-map-support/source-map-support.js:495:21)
        at emit (internal/child_process.js:876:12)
        at processTicksAndRejections (internal/process/task_queues.js:81:21)

version

Cypress: 4.10.0
cypress-terminal-report: 1.4.1

@archfz
Copy link
Owner

archfz commented Jul 31, 2020

Nice catch @JFRabbit . Fix released in 1.4.2. This issue was reproducing in one of the test cases but it was missed since no check was made against it: so now all test cases expect not to break the after each hook.

@archfz archfz closed this as completed Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants