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

Invalid value undefined supplied to /suites/suites/0/tests/0/timedOut: Boolean #88

Closed
JPHamlett1993 opened this issue Jan 22, 2018 · 9 comments

Comments

@JPHamlett1993
Copy link

I am getting the above error with the following json

{
  "stats": {
    "suites": 1,
    "tests": 1,
    "passes": 0,
    "pending": 0,
    "failures": 1,
    "start": "2018-01-22T15:06:36.116Z",
    "end": "2018-01-22T15:06:36.602Z",
    "duration": 486,
    "testsRegistered": 1,
    "passPercent": 0,
    "pendingPercent": 0,
    "other": 0,
    "hasOther": false,
    "skipped": 0,
    "hasSkipped": false,
    "passPercentClass": "danger",
    "pendingPercentClass": "danger"
  },
  "suites": {
    "uuid": "49ace02e-54fe-4939-b896-ca93300bc4f5",
    "title": "",
    "fullFile": "",
    "file": "",
    "beforeHooks": [],
    "afterHooks": [],
    "tests": [],
    "suites": [
      {
        "uuid": "cea92469-5c61-4fdb-8b02-64b2aa4c9657",
        "title": "Add Bank MOP",
        "fullFile": "",
        "file": "",
        "beforeHooks": [],
        "afterHooks": [],
        "tests": [
          {
            "title": "should fail",
            "fullTitle": "Add Bank MOP should fail",
            "duration": 64,
            "state": "failed",
            "pass": false,
            "fail": true,
            "pending": false,
            "code": "cy.visit('localhost:8080');",
            "err": {
              "message": "CypressError: cy.visit() failed trying to load:\n\nhttp://localhost:8080/\n\nWe attempted to make an http request to this URL but the request failed without a response.\n\nWe received this error at the network level:\n\n  > Error: connect ECONNREFUSED 127.0.0.1:8080\n\nCommon situations why this would fail:\n  - you don't have internet access\n  - you forgot to run / boot your web server\n  - your web server isn't accessible\n  - you have weird network configuration settings on your computer\n\nThe stack trace for this error is:\n\nError: connect ECONNREFUSED 127.0.0.1:8080\n    at Object.exports._errnoException (util.js:1026:11)\n    at exports._exceptionWithHostPort (util.js:1049:20)\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)\nFrom previous event:\n    at Server._onResolveUrl (/Users/john.hamlett/Documents/Work/cypress/packages/server/lib/server.coffee:321:11)\n    at backendRequest (/Users/john.hamlett/Documents/Work/cypress/packages/server/lib/socket.coffee:296:23)\nFrom previous event:\n    at Socket.<anonymous> (/Users/john.hamlett/Documents/Work/cypress/packages/server/lib/socket.coffee:312:9)\n    at emitMany (events.js:127:13)\n    at Socket.emit (events.js:201:7)\n    at /Users/john.hamlett/Documents/Work/cypress/packages/socket/node_modules/socket.io/lib/socket.js:503:12\n    at _combinedTickCallback (internal/process/next_tick.js:67:7)\n    at process._tickCallback (internal/process/next_tick.js:98:9)",
              "estack": "CypressError: cy.visit() failed trying to load:\n\nhttp://localhost:8080/\n\nWe attempted to make an http request to this URL but the request failed without a response.\n\nWe received this error at the network level:\n\n  > Error: connect ECONNREFUSED 127.0.0.1:8080\n\nCommon situations why this would fail:\n  - you don't have internet access\n  - you forgot to run / boot your web server\n  - your web server isn't accessible\n  - you have weird network configuration settings on your computer\n\nThe stack trace for this error is:\n\nError: connect ECONNREFUSED 127.0.0.1:8080\n    at Object.exports._errnoException (util.js:1026:11)\n    at exports._exceptionWithHostPort (util.js:1049:20)\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)\nFrom previous event:\n    at Server._onResolveUrl (/Users/john.hamlett/Documents/Work/cypress/packages/server/lib/server.coffee:321:11)\n    at backendRequest (/Users/john.hamlett/Documents/Work/cypress/packages/server/lib/socket.coffee:296:23)\nFrom previous event:\n    at Socket.<anonymous> (/Users/john.hamlett/Documents/Work/cypress/packages/server/lib/socket.coffee:312:9)\n    at emitMany (events.js:127:13)\n    at Socket.emit (events.js:201:7)\n    at /Users/john.hamlett/Documents/Work/cypress/packages/socket/node_modules/socket.io/lib/socket.js:503:12\n    at _combinedTickCallback (internal/process/next_tick.js:67:7)\n    at process._tickCallback (internal/process/next_tick.js:98:9)\n    at Object.cypressErr (http://localhost:51874/__cypress/runner/cypress_runner.js:65969:11)\n    at Object.throwErr (http://localhost:51874/__cypress/runner/cypress_runner.js:65934:18)\n    at Object.throwErrByPath (http://localhost:51874/__cypress/runner/cypress_runner.js:65961:17)\n    at http://localhost:51874/__cypress/runner/cypress_runner.js:57623:31\n    at visitFailedByErr (http://localhost:51874/__cypress/runner/cypress_runner.js:57242:12)\n    at http://localhost:51874/__cypress/runner/cypress_runner.js:57622:22\n    at tryCatcher (http://localhost:51874/__cypress/runner/cypress_runner.js:6268:23)\n    at Promise._settlePromiseFromHandler (http://localhost:51874/__cypress/runner/cypress_runner.js:4290:31)\n    at Promise._settlePromise (http://localhost:51874/__cypress/runner/cypress_runner.js:4347:18)\n    at Promise._settlePromise0 (http://localhost:51874/__cypress/runner/cypress_runner.js:4392:10)\n    at Promise._settlePromises (http://localhost:51874/__cypress/runner/cypress_runner.js:4467:18)\n    at Async._drainQueue (http://localhost:51874/__cypress/runner/cypress_runner.js:1200:16)\n    at Async._drainQueues (http://localhost:51874/__cypress/runner/cypress_runner.js:1210:10)\n    at Async.drainQueues (http://localhost:51874/__cypress/runner/cypress_runner.js:1084:14)"
            },
            "isRoot": false,
            "uuid": "0dcc7c19-1b95-4eca-bbb1-67bf7a6f597f",
            "isHook": false,
            "skipped": false
          }
        ],
        "suites": [],
        "passes": [],
        "failures": [
          "0dcc7c19-1b95-4eca-bbb1-67bf7a6f597f"
        ],
        "pending": [],
        "skipped": [],
        "duration": 64,
        "root": false,
        "rootEmpty": false,
        "_timeout": 2000
      }
    ],
    "passes": [],
    "failures": [],
    "pending": [],
    "skipped": [],
    "duration": 0,
    "root": true,
    "rootEmpty": true,
    "_timeout": 2000
  },
  "copyrightYear": 2018
}

This was generated using Cypress.io, and was unmodified. The HTML is generated just fine if I allow mochawesome to generate the html, however I don't wanna do that I have to do some modifications to the JSON before making the HTML

I am only sending the minimum flags

marge ./json/mochawesome.json -f test --assetsDir=./test/assets

How do I have marge generate the html report?

@JPHamlett1993
Copy link
Author

Had to add the line

"timedOut": false,

To the test. Still make no sense why it would fail while it works using mochawesome

@adamgruber
Copy link
Owner

When you use mochawesome to create the report, it does not validate the JSON data because it assumes that the reporter will provide valid data. However, when you use marge CLI the JSON goes through a validation process to ensure the data has the correct structure since there is no knowing where it came from. That's why you got the error you did.

@Antontelesh
Copy link

So, why is this issue closed? mochawesome does not put the timedOut property into JSON, when marge expects it to be present.

@Antontelesh
Copy link

To give you more context, I'm merging multiple JSON reports generated by mochawesome and then feed the result to marge.

Due to the issue with timedOut property, I'm limited to use the JavaScript API while using CLI would have been simpler.

@stephanmullerNL
Copy link

I'm running into this same problem when running from the CLI. It would be nice if this could be reopened, the problem clearly isn't solved.

@adamgruber
Copy link
Owner

adamgruber commented Dec 27, 2018

The timedOut property doesn't come from mochawesome, it comes from mocha. See here. The problem is that the test object generated by Cypress does not have a timedOut property.

Unfortunately I keep running into scenarios like this. The reporter was initially designed to work only with mocha and is based off of the test object that mocha generates. However there are other libraries that use mocha under the hood so the reporter is compatible but can exhibit unexpected behavior like this.

The JSON validation was put in place to ensure that marge can successfully generate an HTML report without errors or unexpected rendering since you can pass whatever JSON you want to the cli.

Looking closer, the generated HTML report currently doesn't use the timedOut property so I may just relax the validation for this property.

@adamgruber
Copy link
Owner

Fixed with mochawesome-report-generator 3.1.5

@stephanmullerNL
Copy link

Awesome, thanks a bunch!

@ujwaldhakal
Copy link

it didnt fix for me @adamgruber
Invalid value null supplied to /stats/passPercent: Number Invalid value null supplied to /stats/pendingPercent: Number Invalid value undefined supplied to /stats/passPercentClass: PercentClass Invalid value undefined supplied to /stats/pendingPercentClass: PercentClass Invalid value undefined supplied to /suites: Suite Invalid value undefined supplied to /copyrightYear: Number

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

5 participants