Skip to content

Improve tap2junit to accept ANSI code #1756

@BridgeAR

Description

@BridgeAR

Currently our test suite fails badly in case the error contains ANSI code. This is pretty bad since we are starting to use more colors in core, if possible.
Stripping the ANSI is not a good idea, since it's going to hide potential errors. Is it possible to add support for that soonish?

Refs: https://ci.nodejs.org/job/node-test-commit-osx/26144/nodes=osx1011/console

17:11:28 + mkdir out/junit
17:11:28 + tap2junit -i test.tap -o out/junit/test.xml
17:11:30 Traceback (most recent call last):
17:11:30   File "/usr/local/bin/tap2junit", line 11, in <module>
17:11:30     load_entry_point('tap2junit==0.1.4', 'console_scripts', 'tap2junit')()
17:11:30   File "/usr/local/lib/python2.7/site-packages/tap2junit/__main__.py", line 44, in main
17:11:30     result = parse(os.path.splitext(args.input.name)[0], data)
17:11:30   File "/usr/local/lib/python2.7/site-packages/tap2junit/__main__.py", line 11, in parse
17:11:30     tap_parser.parse(data)
17:11:30   File "/usr/local/lib/python2.7/site-packages/tap2junit/tap13.py", line 124, in parse
17:11:30     self._parse(StringIO.StringIO(source))
17:11:30   File "/usr/local/lib/python2.7/site-packages/tap2junit/tap13.py", line 64, in _parse
17:11:30     self.tests[-1].yaml = yamlish.load(self.tests[-1]._yaml_buffer)
17:11:30   File "/usr/local/lib/python2.7/site-packages/yamlish.py", line 222, in load
17:11:30     out = load('\n'.join(inobj), ignore_wrong_characters)
17:11:30   File "/usr/local/lib/python2.7/site-packages/yamlish.py", line 203, in load
17:11:30     out = yaml.load(source, Loader=_YamlishLoader)
17:11:30   File "/usr/local/lib/python2.7/site-packages/yaml/__init__.py", line 69, in load
17:11:30     loader = Loader(stream)
17:11:30   File "/usr/local/lib/python2.7/site-packages/yamlish.py", line 145, in __init__
17:11:30     yaml.loader.SafeLoader.__init__(self, stream)
17:11:30   File "/usr/local/lib/python2.7/site-packages/yaml/loader.py", line 24, in __init__
17:11:30     Reader.__init__(self, stream)
17:11:30   File "/usr/local/lib/python2.7/site-packages/yaml/reader.py", line 74, in __init__
17:11:30     self.check_printable(stream)
17:11:30   File "/usr/local/lib/python2.7/site-packages/yaml/reader.py", line 144, in check_printable
17:11:30     'unicode', "special characters are not allowed")
17:11:30 yaml.reader.ReaderError: unacceptable character #x001b: special characters are not allowed
17:11:30   in "<unicode string>", position 65

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions