Skip to content

Commit

Permalink
fix: re enable csv output which is used in some repos
Browse files Browse the repository at this point in the history
  • Loading branch information
edd committed Aug 20, 2024
1 parent 1f5dc7c commit 2e5ae85
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 23 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vegaprotocol/approbation",
"version": "4.9.2",
"version": "4.9.3",
"description": "Match Acceptance Criteria Codes with the tests that test them",
"engine": ">= 18",
"bin": "./bin/approbation.js",
Expand Down
50 changes: 30 additions & 20 deletions src/check-references.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,28 +321,38 @@ function checkReferences(specsGlob, testsGlob, ignoreGlob, featuresPath, current
console.log(tableOutput)
}

if (!fs.existsSync(outputPath)) {
fs.mkdirSync(outputPath, { recursive: true })
}
if (!fs.existsSync(outputPath)) {
fs.mkdirSync(outputPath, { recursive: true })
}

let cm
// If current milestone is set by parameter, use it
if (currentMilestone) {
cm = totals.find(t => t.Milestone === currentMilestone)
}
// If not, use the most recent
if (!cm) {
cm = totals && totals.length > 0 ? totals.pop() : false
}

let jenkinsLine = `Total ACs: ${criteriaTotal}, Referenced ACs: ${criteriaReferencedTotal}, Unreferenced ACs: ${criteriaUnreferencedTotal}, Coverage: ${criteriaReferencedPercent}%`
if (cm && cm.Milestone && cm.Coverage) {
jenkinsLine += `\r\nCurrent milestone ACs: *${cm.Milestone}*: ${cm.Coverage}`
}

fs.writeFileSync(`${outputPath}/jenkins.txt`, jenkinsLine)
/*
* Output files
*/
let cm
// If current milestone is set by parameter, use it
if (currentMilestone) {
cm = totals.find(t => t.Milestone === currentMilestone)
}
// If not, use the most recent
if (!cm) {
cm = totals && totals.length > 0 ? totals.pop() : false
}

let jenkinsLine = `Total ACs: ${criteriaTotal}, Referenced ACs: ${criteriaReferencedTotal}, Unreferenced ACs: ${criteriaUnreferencedTotal}, Coverage: ${criteriaReferencedPercent}%`
if (cm && cm.Milestone && cm.Coverage) {
jenkinsLine += `\r\nCurrent milestone ACs: *${cm.Milestone}*: ${cm.Coverage}`
}

fs.writeFileSync(`${outputPath}/jenkins.txt`, jenkinsLine)

console.groupEnd()

let csvOutputFiles = Object.keys(specsTableRows[0]).join(',')
specsTableRows.forEach(c => {
csvOutputFiles += `\r\n${Object.values(c).join(',')}`
})
fs.writeFileSync(`${outputPath}/approbation-files.csv`, csvOutputFiles)

console.groupEnd()

return {
exitCode,
Expand Down

0 comments on commit 2e5ae85

Please sign in to comment.