From b2b4637b5086f0f71064260f649f6f759e083cff Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Wed, 18 Feb 2026 14:32:43 +0100 Subject: [PATCH 1/7] feat: add JUnit reporter for unit tests and upload test results --- .github/workflows/frontend-pr-workflow.yml | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/frontend-pr-workflow.yml b/.github/workflows/frontend-pr-workflow.yml index 5f88563..7c625b7 100644 --- a/.github/workflows/frontend-pr-workflow.yml +++ b/.github/workflows/frontend-pr-workflow.yml @@ -281,6 +281,7 @@ on: permissions: id-token: write contents: read + checks: write # Concurrency control: Only cancels runs within the SAME PR concurrency: @@ -383,10 +384,35 @@ jobs: env: GH_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Install JUnit reporter + run: yarn add --dev --no-lockfile jest-junit@^16.0.0 + - name: Run unit tests - run: ${{ inputs.unit-test-command }} + run: ${{ inputs.unit-test-command }} --reporters=default --reporters=jest-junit env: GH_TOKEN: ${{ secrets.GH_TOKEN }} + JEST_JUNIT_OUTPUT_DIR: ./test-results + JEST_JUNIT_OUTPUT_NAME: junit.xml + JEST_JUNIT_CLASSNAME: '{classname}' + JEST_JUNIT_TITLE: '{title}' + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results-${{ github.run_id }} + path: test-results/junit.xml + retention-days: 7 + if-no-files-found: warn + + - name: Test Report + if: always() + uses: dorny/test-reporter@v1 + with: + name: Unit Test Results + path: test-results/junit.xml + reporter: jest-junit + fail-on-error: false - name: Upload coverage if: always() From 6ed1bde6e193752cf29b6abf06a5bebdbda12e28 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Wed, 18 Feb 2026 14:44:59 +0100 Subject: [PATCH 2/7] feat: remove dependency on build job for unit tests --- .github/workflows/frontend-pr-workflow-v1.yml | 1 - .github/workflows/frontend-pr-workflow-v2.yml | 1 - .github/workflows/frontend-pr-workflow.yml | 1 - 3 files changed, 3 deletions(-) diff --git a/.github/workflows/frontend-pr-workflow-v1.yml b/.github/workflows/frontend-pr-workflow-v1.yml index 96ced1f..41d4830 100644 --- a/.github/workflows/frontend-pr-workflow-v1.yml +++ b/.github/workflows/frontend-pr-workflow-v1.yml @@ -296,7 +296,6 @@ jobs: unit-tests: name: 🧪 Unit Tests if: inputs.run-unit-tests - needs: build runs-on: ${{ fromJSON(inputs.runner) }} timeout-minutes: ${{ inputs.test-timeout }} diff --git a/.github/workflows/frontend-pr-workflow-v2.yml b/.github/workflows/frontend-pr-workflow-v2.yml index 0bcaaa3..1352c0f 100644 --- a/.github/workflows/frontend-pr-workflow-v2.yml +++ b/.github/workflows/frontend-pr-workflow-v2.yml @@ -324,7 +324,6 @@ jobs: unit-tests: name: 🧪 Unit Tests if: inputs.run-unit-tests - needs: build runs-on: ${{ fromJSON(inputs.runner) }} timeout-minutes: ${{ inputs.test-timeout }} diff --git a/.github/workflows/frontend-pr-workflow.yml b/.github/workflows/frontend-pr-workflow.yml index 7c625b7..86937a8 100644 --- a/.github/workflows/frontend-pr-workflow.yml +++ b/.github/workflows/frontend-pr-workflow.yml @@ -355,7 +355,6 @@ jobs: unit-tests: name: 🧪 Unit Tests if: inputs.run-unit-tests - needs: build runs-on: ${{ fromJSON(inputs.runner) }} timeout-minutes: ${{ inputs.test-timeout }} From 0e79aee491c9121f98cf7c043014009d0c912f59 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Wed, 18 Feb 2026 14:46:53 +0100 Subject: [PATCH 3/7] feat: update JUnit reporter installation to ignore scripts --- .github/workflows/frontend-pr-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend-pr-workflow.yml b/.github/workflows/frontend-pr-workflow.yml index 86937a8..ff0f97d 100644 --- a/.github/workflows/frontend-pr-workflow.yml +++ b/.github/workflows/frontend-pr-workflow.yml @@ -384,7 +384,7 @@ jobs: GH_TOKEN: ${{ secrets.GH_TOKEN }} - name: Install JUnit reporter - run: yarn add --dev --no-lockfile jest-junit@^16.0.0 + run: yarn add --dev --no-lockfile --ignore-scripts jest-junit@^16.0.0 - name: Run unit tests run: ${{ inputs.unit-test-command }} --reporters=default --reporters=jest-junit From 1abd028c0ea3adc784ef9f2f4d00dcd6c93a6f10 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Wed, 18 Feb 2026 14:59:31 +0100 Subject: [PATCH 4/7] feat: add test summary reporting for unit tests in workflow --- .github/workflows/frontend-pr-workflow.yml | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/frontend-pr-workflow.yml b/.github/workflows/frontend-pr-workflow.yml index ff0f97d..67a69e5 100644 --- a/.github/workflows/frontend-pr-workflow.yml +++ b/.github/workflows/frontend-pr-workflow.yml @@ -395,6 +395,47 @@ jobs: JEST_JUNIT_CLASSNAME: '{classname}' JEST_JUNIT_TITLE: '{title}' + - name: Test Summary + if: always() + run: | + if [ -f test-results/junit.xml ]; then + # Parse JUnit XML for summary stats + TESTS=$(grep -o 'tests="[0-9]*"' test-results/junit.xml | head -1 | grep -o '[0-9]*') + FAILURES=$(grep -o 'failures="[0-9]*"' test-results/junit.xml | head -1 | grep -o '[0-9]*') + ERRORS=$(grep -o 'errors="[0-9]*"' test-results/junit.xml | head -1 | grep -o '[0-9]*') + TIME=$(grep -o 'time="[0-9.]*"' test-results/junit.xml | head -1 | grep -o '[0-9.]*') + PASSED=$((TESTS - FAILURES - ERRORS)) + + if [ "$FAILURES" -gt 0 ] || [ "$ERRORS" -gt 0 ]; then + echo "## ❌ Unit Test Results" >> $GITHUB_STEP_SUMMARY + else + echo "## ✅ Unit Test Results" >> $GITHUB_STEP_SUMMARY + fi + + echo "" >> $GITHUB_STEP_SUMMARY + echo "| Metric | Count |" >> $GITHUB_STEP_SUMMARY + echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY + echo "| ✅ Passed | $PASSED |" >> $GITHUB_STEP_SUMMARY + echo "| ❌ Failed | $FAILURES |" >> $GITHUB_STEP_SUMMARY + echo "| ⚠️ Errors | $ERRORS |" >> $GITHUB_STEP_SUMMARY + echo "| 📊 Total | $TESTS |" >> $GITHUB_STEP_SUMMARY + echo "| ⏱️ Duration | ${TIME}s |" >> $GITHUB_STEP_SUMMARY + + # List failed tests + if [ "$FAILURES" -gt 0 ] || [ "$ERRORS" -gt 0 ]; then + echo "" >> $GITHUB_STEP_SUMMARY + echo "### Failed Tests" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + grep -oP 'testcase[^>]*name="\K[^"]*' test-results/junit.xml | while read -r name; do + # Check if this testcase has a failure element (simplified check) + echo "- \`$name\`" >> $GITHUB_STEP_SUMMARY + done | head -20 + fi + else + echo "## ⚠️ No test results found" >> $GITHUB_STEP_SUMMARY + echo "JUnit XML was not generated at test-results/junit.xml" >> $GITHUB_STEP_SUMMARY + fi + - name: Upload test results if: always() uses: actions/upload-artifact@v4 From d3ed652391ffc1c1d13db4cf366f7ad9790670ab Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Wed, 18 Feb 2026 15:09:08 +0100 Subject: [PATCH 5/7] feat: update unit test reporter installation command to use npm --- .github/workflows/frontend-pr-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend-pr-workflow.yml b/.github/workflows/frontend-pr-workflow.yml index 67a69e5..a5cd31e 100644 --- a/.github/workflows/frontend-pr-workflow.yml +++ b/.github/workflows/frontend-pr-workflow.yml @@ -384,7 +384,7 @@ jobs: GH_TOKEN: ${{ secrets.GH_TOKEN }} - name: Install JUnit reporter - run: yarn add --dev --no-lockfile --ignore-scripts jest-junit@^16.0.0 + run: npm install --no-save --ignore-scripts jest-junit@^16.0.0 - name: Run unit tests run: ${{ inputs.unit-test-command }} --reporters=default --reporters=jest-junit From dd8b4edb67235f4515dd5f2a5b5bd7316535a7c3 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Wed, 18 Feb 2026 15:25:22 +0100 Subject: [PATCH 6/7] fix: replace grep -oP with POSIX-compatible awk for failed test extraction - grep -oP (Perl regex with \K lookbehind) may not work on all runners - Previous logic listed ALL test names, not just failed ones - Fixed head -20 pipe which was attached to done (no stdout output) - awk properly extracts only testcase names containing or - Pipe head -20 >> GITHUB_STEP_SUMMARY now correctly limits and writes output --- .github/workflows/frontend-pr-workflow.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/frontend-pr-workflow.yml b/.github/workflows/frontend-pr-workflow.yml index a5cd31e..48b18fd 100644 --- a/.github/workflows/frontend-pr-workflow.yml +++ b/.github/workflows/frontend-pr-workflow.yml @@ -421,15 +421,22 @@ jobs: echo "| 📊 Total | $TESTS |" >> $GITHUB_STEP_SUMMARY echo "| ⏱️ Duration | ${TIME}s |" >> $GITHUB_STEP_SUMMARY - # List failed tests + # List failed tests using awk (POSIX-compatible, no grep -P needed) if [ "$FAILURES" -gt 0 ] || [ "$ERRORS" -gt 0 ]; then echo "" >> $GITHUB_STEP_SUMMARY echo "### Failed Tests" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY - grep -oP 'testcase[^>]*name="\K[^"]*' test-results/junit.xml | while read -r name; do - # Check if this testcase has a failure element (simplified check) - echo "- \`$name\`" >> $GITHUB_STEP_SUMMARY - done | head -20 + # Extract testcase names that contain or child elements + awk ' + // { in_testcase = 0; } + ' test-results/junit.xml | head -20 >> $GITHUB_STEP_SUMMARY fi else echo "## ⚠️ No test results found" >> $GITHUB_STEP_SUMMARY From 70764ea747b6047debde0872c6300ad543aad5d3 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Wed, 18 Feb 2026 15:35:38 +0100 Subject: [PATCH 7/7] fix: add --legacy-peer-deps to npm install for jest-junit npm install resolves the full project dependency tree and fails on pre-existing peer dep conflicts (eslint@7 vs eslint-config wanting >=9). --legacy-peer-deps skips peer validation, safe for a reporter tool. --- .github/workflows/frontend-pr-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend-pr-workflow.yml b/.github/workflows/frontend-pr-workflow.yml index 48b18fd..9a1f4a9 100644 --- a/.github/workflows/frontend-pr-workflow.yml +++ b/.github/workflows/frontend-pr-workflow.yml @@ -384,7 +384,7 @@ jobs: GH_TOKEN: ${{ secrets.GH_TOKEN }} - name: Install JUnit reporter - run: npm install --no-save --ignore-scripts jest-junit@^16.0.0 + run: npm install --no-save --ignore-scripts --legacy-peer-deps jest-junit@^16.0.0 - name: Run unit tests run: ${{ inputs.unit-test-command }} --reporters=default --reporters=jest-junit