Skip to content

Commit

Permalink
Handle manifest v2 for uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Mar 19, 2024
1 parent 479e198 commit d06c77e
Showing 1 changed file with 80 additions and 36 deletions.
116 changes: 80 additions & 36 deletions .github/actions/upload-turboyet-data/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,91 @@ async function collectResults(manifestFile) {
const isoString = currentDate.toISOString()
const timestamp = isoString.slice(0, 19).replace('T', ' ')

for (const [testFileName, result] of Object.entries(results)) {
let suitePassCount = 0
let suiteFailCount = 0

suitePassCount += result.passed.length
suiteFailCount += result.failed.length

if (suitePassCount > 0) {
passingTests += `${testFileName}\n`
}

if (suiteFailCount > 0) {
failingTests += `${testFileName}\n`
}

for (const passed of result.passed) {
const passedName = passed.replaceAll('`', '\\`')
passingTests += `* ${passedName}\n`
if (results.version === 2) {
for (const [testFileName, result] of Object.entries(results.suites)) {
let suitePassCount = 0
let suiteFailCount = 0

suitePassCount += result.passed.length
suiteFailCount += result.failed.length

if (suitePassCount > 0) {
passingTests += `${testFileName}\n`
}

if (suiteFailCount > 0) {
failingTests += `${testFileName}\n`
}

for (const passed of result.passed) {
const passedName = passed.replaceAll('`', '\\`')
passingTests += `* ${passedName}\n`
}

for (const passed of result.failed) {
const failedName = passed.replaceAll('`', '\\`')
failingTests += `* ${failedName}\n`
}

passCount += suitePassCount
failCount += suiteFailCount

if (suitePassCount > 0) {
passingTests += `\n`
}

if (suiteFailCount > 0) {
failingTests += `\n`
}
}

for (const passed of result.failed) {
const failedName = passed.replaceAll('`', '\\`')
failingTests += `* ${failedName}\n`
const testRun = `${process.env.GITHUB_SHA}\t${timestamp}\t${passCount}/${
passCount + failCount
}`
return { testRun, passingTests, failingTests }
} else {
for (const [testFileName, result] of Object.entries(results)) {
let suitePassCount = 0
let suiteFailCount = 0

suitePassCount += result.passed.length
suiteFailCount += result.failed.length

if (suitePassCount > 0) {
passingTests += `${testFileName}\n`
}

if (suiteFailCount > 0) {
failingTests += `${testFileName}\n`
}

for (const passed of result.passed) {
const passedName = passed.replaceAll('`', '\\`')
passingTests += `* ${passedName}\n`
}

for (const passed of result.failed) {
const failedName = passed.replaceAll('`', '\\`')
failingTests += `* ${failedName}\n`
}

passCount += suitePassCount
failCount += suiteFailCount

if (suitePassCount > 0) {
passingTests += `\n`
}

if (suiteFailCount > 0) {
failingTests += `\n`
}
}
const testRun = `${process.env.GITHUB_SHA}\t${timestamp}\t${passCount}/${
passCount + failCount
}`

passCount += suitePassCount
failCount += suiteFailCount

if (suitePassCount > 0) {
passingTests += `\n`
}

if (suiteFailCount > 0) {
failingTests += `\n`
}
return { testRun, passingTests, failingTests }
}
const testRun = `${process.env.GITHUB_SHA}\t${timestamp}\t${passCount}/${
passCount + failCount
}`

return { testRun, passingTests, failingTests }
}

async function main() {
Expand Down

0 comments on commit d06c77e

Please sign in to comment.