Skip to content

Conversation

@Krinkle
Copy link
Member

@Krinkle Krinkle commented Sep 29, 2024

Don't apply colors to the "ok 1" and "not ok 1" prefix. This has the benefit of making the test names easier to visually extract for developers.

It also increases compatibility with the popular tap-parser package which doesn't parse TAP lines correctly otherwise, since blocks like "not ok" must start on a new line, and with the color code in front, they are technically either a continuation of the previous block, or an ignored "Anything" line between two blocks.

This hasn't been a problem in practice, since, if you pipe output from QUnit or TapReporter to a different process that uses tap-parser, colors are naturally disabled. But, if you get the console output from a browser process, the colors will be applied. I caught this while working on QTap (https://github.com/qunitjs/qtap).

https://github.com/tapjs/tapjs/tree/ccfea67fec/src/parser

https://testanything.org/tap-version-13-specification.html

Before After
Pass
Skip
Failure

@Krinkle Krinkle force-pushed the tap-compliant-colors branch from 0f78270 to 823f7b1 Compare September 29, 2024 18:26
@Krinkle Krinkle requested a review from mgol September 29, 2024 18:31
@Krinkle Krinkle added this to the 3.0 release milestone Sep 29, 2024
Copy link
Member

@mgol mgol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question / suggestion, LGTM overall. The arguments seem sensible and I have no problems with the visual changes.

Don't apply colors to the "ok 1" and "not ok 1" prefix. This has
the benefit of making the test names easier to visually extract
for developers.

It also increases compatibility with the popular `tap-parser`
package which doesn't parse TAP lines correctly otherwise, since
blocks like "not ok" must start on a new line, and with the color
code in front, they are technically either a continuation of the
previous block, or an ignored "Anything" line between two blocks.

https://github.com/tapjs/tapjs/tree/ccfea67fec/src/parser

https://testanything.org/tap-version-13-specification.html
@Krinkle Krinkle force-pushed the tap-compliant-colors branch from 823f7b1 to a005a0b Compare October 9, 2024 16:07
@Krinkle Krinkle merged commit a006064 into qunitjs:main Oct 10, 2024
@Krinkle Krinkle deleted the tap-compliant-colors branch October 10, 2024 00:09
Krinkle added a commit that referenced this pull request Dec 4, 2024
Cherry-picked from a006064 (3.0.0-dev).

> Fixes compatibility with the popular `tap-parser`
> package which doesn't parse TAP lines correctly otherwise, since
> blocks like "not ok" must start on a new line, and with the color
> code in front, they are technically either a continuation of the
> previous block, or an ignored "Anything" line between two blocks.
>
> https://github.com/tapjs/tapjs/tree/ccfea67fec/src/parser
>
> https://testanything.org/tap-version-13-specification.html
>
> Ref #1801.

Includes a partial cherry-pick of 5812597 to clarify the local
name of the onRunEnd argument as `runEnd` instead of `runSuite`.
@Krinkle Krinkle modified the milestones: 3.0 release, 2.x release Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants