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

Tnolet/json reporter #953

Merged
merged 6 commits into from
Jul 12, 2024
Merged

Tnolet/json reporter #953

merged 6 commits into from
Jul 12, 2024

Conversation

tnolet
Copy link
Member

@tnolet tnolet commented Jul 11, 2024

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

Affected Components

  • CLI
  • Create CLI
  • Test
  • Docs
  • Examples
  • Other

Notes for the Reviewer

  • Adds a new JSON reporter, very similar in implementation and usage to the github reporter.
  • Renders the output to a file named checkly-json-report.json.
  • File can be renamed by setting the variable CHECKLY_REPORTER_JSON_OUTPUT
  • Works with npx checkly test and npx checkly trigger by using --reporter json

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."
    }
  ]
}

@tnolet tnolet marked this pull request as ready for review July 11, 2024 14:47
@tnolet tnolet requested a review from clample July 11, 2024 14:50
@tnolet tnolet requested a review from clample July 11, 2024 17:29
@tnolet tnolet merged commit 7e9363c into main Jul 12, 2024
3 checks passed
@tnolet tnolet deleted the tnolet/json-reporter branch July 12, 2024 14:08
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

Successfully merging this pull request may close these issues.

2 participants