@@ -68,6 +68,10 @@ proc parseObject(obj: var object, node: XmlNode) =
6868
6969proc parseTestResult * (node: XmlNode ): RunTestResult =
7070 parseObject (result , node)
71+ # Add handling for failure node
72+ let failureNode = node.child (" failure" )
73+ if not failureNode.isNil:
74+ result .failure = some failureNode.attr (" message" )
7175
7276proc parseTestSuite * (node: XmlNode ): RunTestSuiteResult =
7377 parseObject (result , node)
@@ -91,7 +95,6 @@ proc runTests*(entryPoints: seq[string], nimPath: string, suiteName: Option[stri
9195 error " Entry point does not exist" , entryPoint = entryPoint
9296 return RunTestProjectResult ()
9397
94-
9598 var args = @ [" c" , " -r" , entryPoints[0 ], fmt" --xml:{ resultFile} " ]
9699 if suiteName.isSome:
97100 args.add (fmt" { suiteName.get ()} ::" )
@@ -108,14 +111,17 @@ proc runTests*(entryPoints: seq[string], nimPath: string, suiteName: Option[stri
108111 )
109112 try :
110113 let res = await process.waitForExit (15 .seconds)
111- if res != 0 :
112- error " Failed to run tests" , nimPath = nimPath, entryPoint = entryPoints[0 ], res = res
113- error " An error occurred while running tests" , error = string .fromBytes (process.stderrStream.read ().await)
114+ if not fileExists (resultFile):
115+ let processOutput = string .fromBytes (process.stdoutStream.read ().await)
116+ let processError = string .fromBytes (process.stderrStream.read ().await)
117+ error " Result file does not exist meaning tests were not run"
118+ error " Output from process" , output = processOutput
119+ error " Error from process" , error = processError
114120 else :
115- assert fileExists (resultFile)
116121 let xmlContent = readFile (resultFile)
117122 # echo "XML CONTENT: ", xmlContent
118123 result = parseTestResults (xmlContent)
124+ removeFile (resultFile)
119125 except Exception as e:
120126 let processOutput = string .fromBytes (process.stdoutStream.read ().await)
121127 error " An error occurred while running tests" , error = e.msg
0 commit comments