-
Notifications
You must be signed in to change notification settings - Fork 18
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
Wrong YAML block in TAP report #109
Comments
* Reporter: Fix YAML output in TAP reporter When a message or stack trace contains double quotes, or when the stack trace contains more than one line, we escape the values. Fixes #109 * Reporter: Fix style issues reported by Travis * Reporter: Fix issue when message is undefined. * Reporter: Fix `actual` and `expected` fields in YAML output. * Reporter: Fix unit tests.
There was indeed a bug with multi-line strings. The TAP reporter handled those incorrectly, it simply printed them as-is, without considering the YAML output format that we're inside of. However, while the fix for this was, technically valid, I think it made two mistakes:
I think what matters most is that other command-line programs that follow the TAP spec, can parse the js-reporters TAP output, and receive the actual/expected values in their correct type. That means they should either use neatly-formatted YAML (e.g. literal numbers, multi-line strings, and native objects), or JSON (which is allowed anywhere in YAML). However even when choosing JSON, it should be as a literal, not as a doubly-wrapped string. Consumers must not need to re-parse the JSON sub-portions. It's just handled naturally by any YAML parser. The changes I'll be making:
|
This turns too many values into quoted JSON strings, which makes the output difficult to read. I am reverting this for 1.x-stable to allow other changes to be released and adopted by consumers, such as QUnit. I will improve on the solution in a different way in master for js-reporters 2.0. Ref #109.
This is a different approach to fixing #109. The issue was previously fixed in js-reporters 1.2.2 by #110 but that made multi-line strings difficult to read and left numerous escape hatches in place. That fix has since been reverted to keep 1.x behaving the same has before. The new approach will be part of 2.0. Fixes #109.
This is a different approach to fixing #109. The issue was previously fixed in js-reporters 1.2.2 by #110 but that made multi-line strings difficult to read and left numerous escape hatches in place. That fix has since been reverted to keep 1.x behaving the same has before. The new approach will be part of 2.0. Fixes #109.
YAML blocks in TAP reports may be wrong if one of the fields spans more than one line, which is often the case for stack traces. For example:
The stack trace is not valid YAML. It should follow the YAML line folding rules.
The text was updated successfully, but these errors were encountered: