Skip to content

Commit 926bde1

Browse files
chore: add version and date to test results (#472)
* Update test-e2e.yml * add date to test data * add missing bracket * get total for tests suites * add version as arg * add version to junit2json --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent d22be0c commit 926bde1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.github/workflows/test-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ jobs:
240240
echo "slackEvent<<NETLIFY_EOF" >> $GITHUB_OUTPUT
241241
deno run -A tools/deno/junit2slack.ts --dir artifacts --version ${{matrix.version}} --runUrl ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}} >> $GITHUB_OUTPUT
242242
echo "NETLIFY_EOF" >> $GITHUB_OUTPUT
243-
deno run -A tools/deno/junit2json.ts artifacts > report/test-results.json
243+
deno run -A tools/deno/junit2json.ts artifacts ${{ needs.e2e.outputs.tag }} > report/test-results.json
244244
deno run -A tools/deno/generate-md.ts >> $GITHUB_STEP_SUMMARY
245245
246246
- name: Upload Test JSON

tools/deno/junit2json.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ interface TestSuite {
3737
passed: number
3838
failed: number
3939
skipped: number
40+
total: number
4041
testCases: TestCase[]
4142
}
4243

@@ -88,6 +89,7 @@ function junitToJson(xmlData: {
8889
passed,
8990
failed: Number(failed),
9091
skipped: 0,
92+
total: tests,
9193
testCases: [],
9294
}
9395
const skippedTests = testConfig.skipped.find(
@@ -163,6 +165,8 @@ async function processJUnitFiles(
163165
// Get the directory path from the command-line arguments
164166
const directoryPath = Deno.args[0]
165167

168+
const nextVersion = Deno.args[1]
169+
166170
// Check if the directory path is provided
167171
if (!directoryPath) {
168172
console.error('Please provide a directory path.')
@@ -176,6 +180,8 @@ const testResults = {
176180
...testCount,
177181
total: testCount.passed + testCount.failed + testCount.skipped,
178182
passRate: ((testCount.passed / (testCount.passed + testCount.failed)) * 100).toFixed(2) + '%',
183+
testDate: new Date().toLocaleDateString(),
184+
nextVersion,
179185
results,
180186
}
181187

0 commit comments

Comments
 (0)