checkly / checkly-cli

TS/JS native Monitoring as Code workflow
Apache License 2.0
64 stars 11 forks source link

Tnolet/json reporter #953

Closed tnolet closed 3 months ago

tnolet commented 3 months ago

I hereby confirm that I followed the code guidelines found at engineering guidelines

Affected Components

Notes for the Reviewer

How do I test this?

Run any test or trigger command with the --reporter json flag. Optionally add the --record flag. Inspect the output in the saved JSON file.

Output looks like:

{
  "testSessionId": "a33d6e8a-34c5-44a6-9ba2-01219d44847c",
  "numChecks": 8,
  "runLocation": "eu-central-1",
  "checks": [
    {
      "result": "Pass",
      "name": "Acme API 12",
      "checkType": "API",
      "durationMilliseconds": 135,
      "filename": "__checks__/checkly-api-2.check.ts",
      "link": "https://app.checklyhq.com/test-sessions/a33d6e8a-34c5-44a6-9ba2-01219d44847c/results/552acf23-0276-4afe-adf0-9fbd393262e5",
      "runError": null
    },
    {
      "result": "Pass",
      "name": "Acme API 123",
      "checkType": "API",
      "durationMilliseconds": 117,
      "filename": "__checks__/checkly-api-3.check.ts",
      "link": "https://app.checklyhq.com/test-sessions/a33d6e8a-34c5-44a6-9ba2-01219d44847c/results/441136d1-048a-4a37-bfac-60b0380df1e4",
      "runError": null
    },
    {
      "result": "Pass",
      "name": "Acme API 1",
      "checkType": "API",
      "durationMilliseconds": 147,
      "filename": "__checks__/checkly-api.check.ts",
      "link": "https://app.checklyhq.com/test-sessions/a33d6e8a-34c5-44a6-9ba2-01219d44847c/results/c0f56575-2c7d-470f-a3e5-e2c4a1942caf",
      "runError": null
    },
    {
      "result": "Pass",
      "name": "Acme API 2",
      "checkType": "API",
      "durationMilliseconds": 109,
      "filename": "__checks__/checkly-api.check.ts",
      "link": "https://app.checklyhq.com/test-sessions/a33d6e8a-34c5-44a6-9ba2-01219d44847c/results/056e4b36-55da-438c-aed1-507c84713d3a",
      "runError": null
    },
    {
      "result": "Fail",
      "name": "Acme webapp",
      "durationMilliseconds": null,
      "filename": "__checks__/checkly-homepage.check.ts",
      "link": "https://app.checklyhq.com/test-sessions/a33d6e8a-34c5-44a6-9ba2-01219d44847c/results/e4d5d905-ecc3-4831-bc5c-39b9d91f356e",
      "runError": "Reached timeout of 1 seconds waiting for check result."
    },
    {
      "result": "Fail",
      "name": "Acme webapp",
      "durationMilliseconds": null,
      "filename": "__checks__/checkly-homepage.check.ts",
      "link": "https://app.checklyhq.com/test-sessions/a33d6e8a-34c5-44a6-9ba2-01219d44847c/results/56a718ed-3b4d-4622-b1ae-d8474bc6e8d7",
      "runError": "Reached timeout of 1 seconds waiting for check result."
    },
    {
      "result": "Fail",
      "name": "local.spec.ts",
      "durationMilliseconds": null,
      "filename": "__checks__/local.spec.ts",
      "link": "https://app.checklyhq.com/test-sessions/a33d6e8a-34c5-44a6-9ba2-01219d44847c/results/2fe21340-dc32-44f8-b65e-67869e6e11e9",
      "runError": "Reached timeout of 1 seconds waiting for check result."
    },
    {
      "result": "Fail",
      "name": "nextjs.spec.ts",
      "durationMilliseconds": null,
      "filename": "__checks__/nextjs.spec.ts",
      "link": "https://app.checklyhq.com/test-sessions/a33d6e8a-34c5-44a6-9ba2-01219d44847c/results/c15e687f-fb69-4644-8b72-b77e6c516624",
      "runError": "Reached timeout of 1 seconds waiting for check result."
    }
  ]
}