Add debug logging if JSON parse fails (#223)

This commit is contained in:
Marco Munizaga 2023-07-05 11:59:03 -07:00 committed by GitHub
parent 9277cff3bd
commit ec32d36cab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -55,8 +55,19 @@ export async function run(namespace: string, compose: ComposeSpecification, opts
if (testResults === null || testResults.length < 2) {
throw new Error("Test JSON results not found")
}
const testResultsParsed = JSON.parse(testResults[1])
console.log("Finished:", namespace, testResultsParsed)
try {
const testResultsParsed = JSON.parse(testResults[1])
console.log("Finished:", namespace, testResultsParsed)
} catch (e) {
console.log("Failed to parse test results:", testResults[1])
console.log("stdout:")
console.log(stdout)
console.log("")
console.log("stderr:")
console.log(stderr)
console.log("")
throw e
}
} catch (e: any) {
console.log("Failure", e)
return e