cairo icon indicating copy to clipboard operation
cairo copied to clipboard

feat: export tests results as JSON

Open notV4l opened this issue 2 years ago • 1 comments

Add an --export parameter to cairo-test accepting a path to export tests results as JSON.

use :

cairo-test ./src/tests.cairo --single-file --export ./tests.json

example results for Success / Fail :

[
  {
    "name": "tests::tests::test_1",
    "status": "Success",
    "gas_usage": 500
  },
 {
    "name": "tests::tests::test_2",
    "status": "Fail",
    "gas_usage": 1600,
    "error_messages": [
      "this is panic !!!",
      "with",
      "a long",
      "message"
    ]
  }
]

This change is Reviewable

notV4l avatar Jul 30 '23 01:07 notV4l

I don't feel able to make modifs to make it work the way @mkaput described. I could make a PR to fit @orizi requested changes (just let me know) but you maybe want to rework/implement this feature the way @mkaput suggested. Anyway it could be convenient to have a simple JSON file as export option.

notV4l avatar Jul 31 '23 16:07 notV4l