hulu / roca

A command-line tool for running brightscript tests
Apache License 2.0
25 stars 19 forks source link

Escape YAML characters in error output #72

Closed lkipke closed 3 years ago

lkipke commented 3 years ago

Summary

We're not escaping strings in our YAML output, which is causing some weirdness:

m.assert.equal("[what?", "yeah...")

The above causes tap-mocha-parser to incorrectly parse our YAML output, so we print out the raw (normally hidden) YAML:

        ---
                error:
                    message: Unexpected result
                    name: m.assert.equal
                    stack: m.assert.equal (/sandbox/tests/source/utils.test.brs:17:14)
                    stackframes:
                        - /sandbox/tests/source/utils.test.brs:17:14
                        - /sandbox/tests/source/utils.test.brs:2:11
                        - /sandbox/tests/source/utils.test.brs:2:4
                found: [what?
                wanted: yeah...
        ...

This actually isn't awful. It gives the user more information than tap-mocha-reporter does -- but it also doesn't look very nice and is an unexpected result.