Convert Whitespace to Visible Characters on Error

This commit is contained in:
Josh Johnson 2020-07-06 22:25:19 -04:00
parent afd09bcc2e
commit 7675807586

View File

@ -130,7 +130,7 @@ function testFormatter(xmlFormatter: XmlFormatter, options: XmlFormattingOptions
const actualFormattedXml = xmlFormatter.formatXml(unformattedXml, options).replace(/\r/, "").trim();
// tslint:disable-next-line
assert.ok((actualFormattedXml === expectedFormattedXml), `Actual formatted XML does not match expected formatted XML.\n\nACTUAL\n${actualFormattedXml}\n\nEXPECTED\n${expectedFormattedXml}`);
assert.ok((actualFormattedXml === expectedFormattedXml), `Actual formatted XML does not match expected formatted XML.\n\nACTUAL\n${actualFormattedXml.replace(/\n/, "~n").replace(" ", "~s")}\n\nEXPECTED\n${expectedFormattedXml.replace(/\n/, "~n").replace(" ", "~s")}`);
}
function testMinifier(xmlFormatter: XmlFormatter, options: XmlFormattingOptions, fileLabel: string): void {
@ -140,5 +140,5 @@ function testMinifier(xmlFormatter: XmlFormatter, options: XmlFormattingOptions,
const actualMinifiedXml = xmlFormatter.minifyXml(unminifiedXml, options).replace(/\r/, "").trim();
// tslint:disable-next-line
assert.ok((actualMinifiedXml === expectedMinifiedXml), `Actual minified XML does not match expected minified XML.\n\nACTUAL\n${actualMinifiedXml}\n\nEXPECTED\n${expectedMinifiedXml}`);
assert.ok((actualMinifiedXml === expectedMinifiedXml), `Actual minified XML does not match expected minified XML.\n\nACTUAL\n${actualMinifiedXml.replace(/\n/, "~n").replace(" ", "~s")}\n\nEXPECTED\n${expectedMinifiedXml.replace(/\n/, "~n").replace(" ", "~s")}`);
}