@@ -196,6 +196,8 @@ jobs:
196196
197197 steps :
198198 - uses : actions/checkout@v4
199+ with :
200+ fetch-depth : 0
199201
200202 - name : Fetch gh-pages branch
201203 run : |
@@ -222,6 +224,28 @@ jobs:
222224 destination_dir : .
223225 force_orphan : true
224226
227+ - name : Count new tests
228+ id : count_tests
229+ run : |
230+ git fetch origin main:main
231+
232+ # Get list of changed test files
233+ changed_files=$(git diff --name-only main...HEAD | grep -E '.*\.(spec|test)\.(ts|tsx|js|jsx)$' || true)
234+
235+ # Count new test cases
236+ new_tests=0
237+ for file in $changed_files; do
238+ if git show HEAD:$file > /dev/null 2>&1; then
239+ new_cases=$(git show HEAD:$file | grep -c "it\('" || true)
240+ base_cases=$(git show main:$file 2>/dev/null | grep -c "it\('" || true)
241+ ((new_tests += new_cases - base_cases))
242+ else
243+ # If file is completely new, count all test cases
244+ new_tests+=$(git show HEAD:$file | grep -c "it\('" || true)
245+ fi
246+ done
247+ echo "new_tests=$new_tests" >> $GITHUB_OUTPUT
248+
225249 - name : Update PR description
226250 uses : actions/github-script@v6
227251 with :
@@ -266,14 +290,17 @@ jobs:
266290 parseFloat(percent) > 0 ? 'πΊ' :
267291 parseFloat(percent) < 0 ? 'π½' : 'β
';
268292
293+ const newTests = parseInt('${{ steps.count_tests.outputs.new_tests }}');
294+ const testsStatus = newTests > 0 ? 'β¨' : 'β';
295+
269296 const ciSection = `## CI Results
270297
271298 ### Test Status: <span style="color: ${statusColor};">${status}</span>
272299 π [Full Report](${reportUrl})
273300
274- | Total | Passed | Failed | Flaky | Skipped |
275- |:-----:|:------:|:------:|:-----:|:-------:|
276- | ${testResults.total} | ${testResults.passed} | ${testResults.failed} | ${testResults.flaky} | ${testResults.skipped} |
301+ | Total | Passed | Failed | Flaky | Skipped | New Tests |
302+ |:-----:|:------:|:------:|:-----:|:-------:|:---------:|
303+ | ${testResults.total} | ${testResults.passed} | ${testResults.failed} | ${testResults.flaky} | ${testResults.skipped} | ${testsStatus} ${newTests} |
277304
278305 ### Bundle Size: ${bundleStatus}
279306 Current: ${formatSize(currentSize)} | Main: ${formatSize(mainSize)}
@@ -292,6 +319,7 @@ jobs:
292319 - Bundle size is measured for the entire 'dist' directory.
293320 - π indicates links to detailed reports.
294321 - πΊ indicates increase, π½ decrease, and β
no change in bundle size.
322+ - ${testsStatus} indicates ${newTests} new test cases added in this PR.
295323 </details>`;
296324
297325 const { data: pullRequest } = await github.rest.pulls.get({
0 commit comments