Skip to content

Clean up validation outputs #19

@cybertk

Description

@cybertk

Currently, the outputs of validation is raw mocha results, it's a bit verbose.

Like,

  21) /repos/{ownerId}/{repoId}/milestones POST response 201:
     AssertionError: Got unexpected response body:
{
    "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    "number": 1,
    "state": "open",
    "title": "v1.0",
    "description": "",
    "creator": {
        "login": "octocat",
        "id": 1,
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "gravatar_id": "somehexcode",
        "url": "https://api.github.com/users/octocat"
    },
    "open_issues": 4,
    "closed_issues": 8,
    "created_at": "2011-04-10T20:09:31Z",
    "due_on": null
}
Error: expected value to match json-schema '{"$schema":"http://json-schema...' -> '{"url":"https://api.github.com...'
      invalid type: null (expected string)
          schema: {"$schema":"http://json-schema.org/draft-03/schema","type":"...
          rule:   /properties/due_on/type -> "string"
          field:  /due_on -> null: null
      at Function.assert.jsonSchema (/usr/local/lib/node_modules/ramlev/node_modules/chai-json-schema/index.js:176:40)
      at Test.assertExample (/usr/local/lib/node_modules/ramlev/lib/test.js:77:21)
      at Test.assertExample (/usr/local/lib/node_modules/ramlev/lib/test.js:3:61)
      at Test.run (/usr/local/lib/node_modules/ramlev/lib/test.js:56:21)
      at Object.suite.addTest.Mocha.Test._.bind.test (/usr/local/lib/node_modules/ramlev/lib/test-runner.js:37:19)
      at Test.Runnable.run (/usr/local/lib/node_modules/ramlev/node_modules/mocha/lib/runnable.js:217:15)
      at Runner.runTest (/usr/local/lib/node_modules/ramlev/node_modules/mocha/lib/runner.js:373:10)
      at /usr/local/lib/node_modules/ramlev/node_modules/mocha/lib/runner.js:451:12
      at next (/usr/local/lib/node_modules/ramlev/node_modules/mocha/lib/runner.js:298:14)
      at /usr/local/lib/node_modules/ramlev/node_modules/mocha/lib/runner.js:308:7

Places can improve:

  • Remove error stack
  • Locate the line # of invalid example in RAML
  • Better error output for json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions