ctrf-io / ctrf-io/github-test-reporter

Use GitHub markdown diff syntax highlighting for assertion failures

Open
#254 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
376
Forks
42
PR merge metrics
No merged PRs in 30d

Description

It would be nice if assertion failures used syntax highlighting, to make them easier to read, especially when the output is long (e.g. assert.deepEqual).

The following markdown achieves this without changing the layout:

Failed Tests
❌ Test name
... Skipped lines
  {
    thing: {
+     id: 111,
-     id: 222,
      prop1: 'aaa',
      prop2: 'bbb'
    },
    prop3: 'ccc',
    prop4: 'ddd',
...
          {
+           id: 333,
-           id: 555,
          }
        ],
        prop5: 'eee',
        prop6: 'fff',
        prop7: [
<table>
  <thead>
    <tr>
      <th>Failed Tests</th>
    </tr>
  </thead>
  <tbody>
      <tr>
        <td>
<details>
<summary>❌ Test name</summary>

```diff
... Skipped lines
  {
    thing: {
+     id: 111,
-     id: 222,
      prop1: 'aaa',
      prop2: 'bbb'
    },
    prop3: 'ccc',
    prop4: 'ddd',
...
          {
+           id: 333,
-           id: 555,
          }
        ],
        prop5: 'eee',
        prop6: 'fff',
        prop7: [
```
</details>
        </td>
      </tr>
  </tbody>
</table>

It's a bit clumsy, because of the HTML table, but seems to render okay on GitHub. Can you see any drawbacks?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the code that formats assertion failures and the generated GitHub test summary, then compare its output with the proposed diff-markdown example. The work is done when long assertion failures render with GitHub diff syntax highlighting without changing the existing layout; the payload names no specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.