aiken-lang / aiken

A modern smart contract platform for Cardano
https://aiken-lang.org
Apache License 2.0
474 stars 92 forks source link

Add json flag for check command #1021

Open Riley-Kilgore opened 1 month ago

Riley-Kilgore commented 1 month ago

Running aiken check --json will not print warnings; Compilation Errors will print as normal and cause json to not be provided as output; assertion message needs work.

Example output:

{
  "seed": 2661348879,
  "modules": [
    {
      "name": "common/utils",
      "tests": [
        {
          "name": "test_always_fail",
          "status": "FAIL",
          "execution_units": {
            "memory": 200,
            "cpu": 16100
          },
          "assertion": {
            "message": "\u001b[1m\u001b[31m× expected\u001b[39m\u001b[0m\n\u001b[31m│\u001b[39m 2\n\u001b[1m\u001b[31m× to equal\u001b[39m\u001b[0m\n\u001b[31m│\u001b[39m 1",
            "expected_to_fail": false
          }
        },
        {
          "name": "test_always_succeed",
          "status": "PASS",
          "execution_units": {
            "memory": 200,
            "cpu": 16100
          }
        }
      ],
      "summary": {
        "total": 2,
        "passed": 1,
        "failed": 1
      }
    }
  ],
  "summary": {
    "total_tests": 2,
    "passed_tests": 1,
    "failed_tests": 1,
    "module_count": 1,
    "max_execution_units": {
      "memory": 3,
      "cpu": 5
    },
    "max_iterations": 1,
    "modules": [
      {
        "name": "common/utils",
        "tests": [
          {
            "name": "test_always_fail",
            "status": "FAIL",
            "execution_units": {
              "memory": 200,
              "cpu": 16100
            },
            "assertion": {
              "message": "\u001b[1m\u001b[31m× expected\u001b[39m\u001b[0m\n\u001b[31m│\u001b[39m 2\n\u001b[1m\u001b[31m× to equal\u001b[39m\u001b[0m\n\u001b[31m│\u001b[39m 1",
              "expected_to_fail": false
            }
          },
          {
            "name": "test_always_succeed",
            "status": "PASS",
            "execution_units": {
              "memory": 200,
              "cpu": 16100
            }
          }
        ],
        "summary": {
          "total": 2,
          "passed": 1,
          "failed": 1
        }
      }
    ]
  }
}