From 4b7fef7e6a75fe421b01dd1e9497f7d2310bcf59 Mon Sep 17 00:00:00 2001 From: ankasani Date: Thu, 9 Mar 2023 20:10:33 +0530 Subject: [PATCH 1/3] Fix merge-nunit-xml issue Using the option --merged-file-name "output.xml" --test-output-dir JunitTestResult, facing the below issue, i can see .zip was was downloaded but merged files is not working! Downloaded artifacts to JunitTestResult\junit_xml_zip.zip Error: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Document Similer issue with nunit for xamarin uitest: https://github.com/microsoft/appcenter-cli/pull/1814 --- src/commands/test/run/appium.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/commands/test/run/appium.ts b/src/commands/test/run/appium.ts index c548ed8c5..2f7a729aa 100644 --- a/src/commands/test/run/appium.ts +++ b/src/commands/test/run/appium.ts @@ -4,6 +4,7 @@ import { generateAbsolutePath } from "../../../util/misc/fs-helper"; import { CommandArgs, help, longName, hasArg, required } from "../../../util/commandline"; import { AppiumPreparer } from "../lib/appium-preparer"; import { Messages } from "../lib/help-messages"; +import { XMLSerializer } from "@xmldom/xmldom"; import { JUnitXmlUtil } from "../lib/junit-xml-util"; import { RunTestsDownloadResultCommand } from "../lib/run-tests-download-result-command"; @@ -58,6 +59,7 @@ export default class RunAppiumTestsCommand extends RunTestsDownloadResultCommand throw new Error(`Couldn't merge xml test results to ${this.mergeJUnitXml}`); } - return pfs.writeFile(path.join(reportPath, this.mergeJUnitXml), xml); + const strXml: string = new XMLSerializer().serializeToString(xml); + return pfs.writeFile(path.join(reportPath, this.mergeJUnitXml), strXml); } } From 1bea0e5a942dfc339f6d4feb99b6acb4413e81c8 Mon Sep 17 00:00:00 2001 From: ankasani Date: Thu, 9 Mar 2023 22:03:08 +0530 Subject: [PATCH 2/3] Fix merged-file-name issue Using the option merged-file-name "output.xml" --test-output-dir JunitTestResult, facing the below issue, i can see .zip was was downloaded but merged files is not working! Downloaded artifacts to JunitTestResult\junit_xml_zip.zip Error: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Document --- src/commands/test/run/manifest.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/commands/test/run/manifest.ts b/src/commands/test/run/manifest.ts index 6425d1431..6c65618bb 100644 --- a/src/commands/test/run/manifest.ts +++ b/src/commands/test/run/manifest.ts @@ -2,6 +2,7 @@ import { CommandArgs, help, longName, required, hasArg } from "../../../util/com import { Messages } from "../lib/help-messages"; import * as path from "path"; import { writeFile, walk } from "../../../util/misc/promisfied-fs"; +import { XMLSerializer } from "@xmldom/xmldom"; import { XmlUtil } from "../lib/xml-util"; import { XmlUtilBuilder } from "../lib/xml-util-builder"; import { generateAbsolutePath } from "../../../util/misc/fs-helper"; @@ -65,6 +66,7 @@ export default class RunManifestTestsCommand extends RunTestsDownloadResultComma throw new Error("XML merging has ended with an error"); } - await writeFile(path.join(outputDir, this.outputXmlName), xml); + const strXml: string = new XMLSerializer().serializeToString(xml); + await writeFile(path.join(outputDir, this.outputXmlName), strXml); } } From e0a97aad079c29217223c6fcb46c2e53d0a10555 Mon Sep 17 00:00:00 2001 From: ankasani Date: Sat, 11 Mar 2023 12:55:32 +0530 Subject: [PATCH 3/3] =?UTF-8?q?Fixed=20error=20Delete=20=C2=B7=C2=B7=C2=B7?= =?UTF-8?q?=C2=B7=20prettier/prettier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /home/vsts/work/1/s/src/commands/test/run/appium.ts 62:5 error Delete ···· prettier/prettier 63:1 error Delete ···· prettier/prettier Issue was with file format, fix it! --- src/commands/test/run/appium.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/test/run/appium.ts b/src/commands/test/run/appium.ts index 2f7a729aa..327c556fd 100644 --- a/src/commands/test/run/appium.ts +++ b/src/commands/test/run/appium.ts @@ -59,7 +59,7 @@ export default class RunAppiumTestsCommand extends RunTestsDownloadResultCommand throw new Error(`Couldn't merge xml test results to ${this.mergeJUnitXml}`); } - const strXml: string = new XMLSerializer().serializeToString(xml); - return pfs.writeFile(path.join(reportPath, this.mergeJUnitXml), strXml); + const strXml: string = new XMLSerializer().serializeToString(xml); + return pfs.writeFile(path.join(reportPath, this.mergeJUnitXml), strXml); } }