Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse attributeless <failure> tags correctly
[`jest-junit`](https://github.com/jest-community/jest-junit) generates failure tags that have no attributes, only inner text. For example: `<failure>Failed!</failure>`. The [`xml2js`](https://www.npmjs.com/package/xml2js) library seems to produce different objects based on whether a tag has attributes. See the minimal example: ```js var parseString = require('xml2js').parseString; var print = (err, result) => console.log(JSON.stringify(result, null, 2)) var parse = (xmlStr) => parseString(xmlStr, print) parse('<a b="c">d</a>') { "a": { "_": "d", "$": { "b": "c" } } } parse('<a>d</a>') { "a": "d" } ``` Notice how the second output above is not `{"a": {"_": "d"}}` With this change, we take into account this difference while parsing the failure messages.
- Loading branch information