ava icon indicating copy to clipboard operation
ava copied to clipboard

Improve test result accessibility

Open gibson042 opened this issue 3 years ago • 2 comments
trafficstars

  • Explain diff gutter symbols.
  • Add test result labels (color covers figure and label, and indicates passed-as-expected vs. not).
  • Bold the source line of errors in code excerpts.

Fixes #1558 Fixes #2919

example output

gibson042 avatar Aug 06 '22 19:08 gibson042

This produces lots of failures like the following; how do I update the [TAP] test expectations in bulk?

        not ok 43 - should be equal
          ---
          compare: ===
          at:
            line: 59
            column: 6
            file: file:///home/runner/work/ava/ava/test-tap/assert.js
            function: assertFailure
          stack: |
            assertFailure (file://test-tap/assert.js:59:6)
            failsWith (file://test-tap/assert.js:98:2)
            Test.<anonymous> (file://test-tap/assert.js:277:2)
            file://test-tap/assert.js:202:1
          diff: |
            --- expected
            +++ actual
            @@ -1,1 +1,1 @@
            -Difference:
            +Difference (- actual, + expected):
          ...

gibson042 avatar Aug 06 '22 19:08 gibson042

Found it: https://github.com/avajs/ava/blob/main/test-tap/reporters/readme.md

gibson042 avatar Aug 07 '22 06:08 gibson042

@sindresorhus what do you think?

novemberborn avatar Aug 13 '22 13:08 novemberborn

Thank you @gibson042, very exciting!

Note that we're seeing similar CI failures on the main branch, so let's not worry about those here.

novemberborn avatar Aug 13 '22 13:08 novemberborn

I agree with almost everything. However, I'm not a big fan of the PASS: and FAIL: noise. I think the icons are clear enough for the common case and we could instead only use the prefixes for the other cases like EXPECTED FAIL and SKIP.

sindresorhus avatar Aug 15 '22 00:08 sindresorhus

I agree with almost everything. However, I'm not a big fan of the PASS: and FAIL: noise. I think the icons are clear enough for the common case and we could instead only use the prefixes for the other cases like EXPECTED FAIL and SKIP.

@sindresorhus Without "PASS" and "FAIL", vision-impaired consumers are left to infer semantics from information like "check mark" and "multiplication symbol" (the latter improved a bit after https://github.com/sindresorhus/figures/issues/92 ). I'd prefer to keep the verbosity in support of accessibility and output consistency, but if you still disagree then let me know and I'll remove them.

gibson042 avatar Aug 16 '22 16:08 gibson042

@gibson042 I should have some time this week to help get this over the line.

novemberborn avatar Aug 22 '22 08:08 novemberborn

I agree with almost everything. However, I'm not a big fan of the PASS: and FAIL: noise. I think the icons are clear enough for the common case and we could instead only use the prefixes for the other cases like EXPECTED FAIL and SKIP.

@sindresorhus Without "PASS" and "FAIL", vision-impaired consumers are left to infer semantics from information like "check mark" and "multiplication symbol" (the latter improved a bit after sindresorhus/figures#92 ). I'd prefer to keep the verbosity in support of accessibility and output consistency, but if you still disagree then let me know and I'll remove them.

@sindresorhus how strongly do you feel about this?

I do like the consistency.

novemberborn avatar Aug 27 '22 16:08 novemberborn

@sindresorhus how strongly do you feel about this?

I don't feel strongly about it.

sindresorhus avatar Aug 28 '22 16:08 sindresorhus

I do like the consistency.

Most assertion will be pass or fail, so there wouldn't be much inconsistency in practice. And it may even have been beneficial to make the uncommon cases more obvious. The result now is also more noisy.

sindresorhus avatar Aug 28 '22 16:08 sindresorhus

Project name aside, we don't really use all caps. I've pushed a commit to use lowercase and put it in square brackets.

Most of the time, most tests pass. So I've removed the prefix for passed tests.

I also noticed that the assertion message was only differentiated from the test title by color, so I've made that italic.

novemberborn avatar Sep 04 '22 14:09 novemberborn