From 5c90b26631e7d855f2ad7ceddf104bbd8955df3a Mon Sep 17 00:00:00 2001 From: Pierre Chalamet Date: Sat, 29 Jun 2024 22:25:29 +0200 Subject: [PATCH] add link --- __tests__/__outputs__/dart-json.md | 3 ++- __tests__/__outputs__/dotnet-nunit.md | 3 ++- __tests__/__outputs__/dotnet-trx.md | 3 ++- __tests__/__outputs__/fluent-validation-test-results.md | 3 ++- __tests__/__outputs__/jest-junit-eslint.md | 3 ++- __tests__/__outputs__/jest-junit.md | 3 ++- __tests__/__outputs__/jest-react-component-test-results.md | 3 ++- __tests__/__outputs__/jest-test-results.md | 3 ++- __tests__/__outputs__/mocha-json.md | 3 ++- __tests__/__outputs__/mocha-test-results.md | 3 ++- __tests__/__outputs__/provider-test-results.md | 3 ++- __tests__/__outputs__/pulsar-test-results-no-merge.md | 3 ++- __tests__/__outputs__/pulsar-test-results.md | 3 ++- __tests__/__outputs__/rspec-json.md | 3 ++- __tests__/__outputs__/silent-notes-test-results.md | 3 ++- __tests__/__outputs__/swift-xunit.md | 3 ++- dist/index.js | 3 ++- src/report/get-report.ts | 4 +++- 18 files changed, 37 insertions(+), 18 deletions(-) diff --git a/__tests__/__outputs__/dart-json.md b/__tests__/__outputs__/dart-json.md index dfe8e05..9f1b5ef 100644 --- a/__tests__/__outputs__/dart-json.md +++ b/__tests__/__outputs__/dart-json.md @@ -1,4 +1,5 @@ -![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%204%20failed%2C%201%20skipped-critical) +[![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%204%20failed%2C%201%20skipped-critical)](#test-report) +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/dart-json.json|1 ✅|4 ❌|1 ⚪|4s| diff --git a/__tests__/__outputs__/dotnet-nunit.md b/__tests__/__outputs__/dotnet-nunit.md index c7f2d52..e1f10ae 100644 --- a/__tests__/__outputs__/dotnet-nunit.md +++ b/__tests__/__outputs__/dotnet-nunit.md @@ -1,4 +1,5 @@ -![Tests failed](https://img.shields.io/badge/tests-3%20passed%2C%205%20failed%2C%201%20skipped-critical) +[![Tests failed](https://img.shields.io/badge/tests-3%20passed%2C%205%20failed%2C%201%20skipped-critical)](#test-report) +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/dotnet-nunit.xml|3 ✅|5 ❌|1 ⚪|230ms| diff --git a/__tests__/__outputs__/dotnet-trx.md b/__tests__/__outputs__/dotnet-trx.md index 7a38b19..fe7a688 100644 --- a/__tests__/__outputs__/dotnet-trx.md +++ b/__tests__/__outputs__/dotnet-trx.md @@ -1,4 +1,5 @@ -![Tests failed](https://img.shields.io/badge/tests-5%20passed%2C%205%20failed%2C%201%20skipped-critical) +[![Tests failed](https://img.shields.io/badge/tests-5%20passed%2C%205%20failed%2C%201%20skipped-critical)](#test-report) +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/dotnet-trx.trx|5 ✅|5 ❌|1 ⚪|1s| diff --git a/__tests__/__outputs__/fluent-validation-test-results.md b/__tests__/__outputs__/fluent-validation-test-results.md index fe13390..a4093fe 100644 --- a/__tests__/__outputs__/fluent-validation-test-results.md +++ b/__tests__/__outputs__/fluent-validation-test-results.md @@ -1,6 +1,7 @@ -![Tests passed successfully](https://img.shields.io/badge/tests-803%20passed%2C%201%20skipped-success) +[![Tests passed successfully](https://img.shields.io/badge/tests-803%20passed%2C%201%20skipped-success)](#test-report)
Expand for details +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/external/FluentValidation.Tests.trx|803 ✅||1 ⚪|4s| diff --git a/__tests__/__outputs__/jest-junit-eslint.md b/__tests__/__outputs__/jest-junit-eslint.md index 32608c3..9be2bc3 100644 --- a/__tests__/__outputs__/jest-junit-eslint.md +++ b/__tests__/__outputs__/jest-junit-eslint.md @@ -1,6 +1,7 @@ -![Tests passed successfully](https://img.shields.io/badge/tests-1%20passed-success) +[![Tests passed successfully](https://img.shields.io/badge/tests-1%20passed-success)](#test-report)
Expand for details +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/jest-junit-eslint.xml|1 ✅|||0ms| diff --git a/__tests__/__outputs__/jest-junit.md b/__tests__/__outputs__/jest-junit.md index 7c577d3..dd64a0c 100644 --- a/__tests__/__outputs__/jest-junit.md +++ b/__tests__/__outputs__/jest-junit.md @@ -1,4 +1,5 @@ -![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%204%20failed%2C%201%20skipped-critical) +[![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%204%20failed%2C%201%20skipped-critical)](#test-report) +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/jest-junit.xml|1 ✅|4 ❌|1 ⚪|1s| diff --git a/__tests__/__outputs__/jest-react-component-test-results.md b/__tests__/__outputs__/jest-react-component-test-results.md index e9dda68..dee5cdd 100644 --- a/__tests__/__outputs__/jest-react-component-test-results.md +++ b/__tests__/__outputs__/jest-react-component-test-results.md @@ -1,6 +1,7 @@ -![Tests passed successfully](https://img.shields.io/badge/tests-1%20passed-success) +[![Tests passed successfully](https://img.shields.io/badge/tests-1%20passed-success)](#test-report)
Expand for details +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/external/jest/jest-react-component-test-results.xml|1 ✅|||1000ms| diff --git a/__tests__/__outputs__/jest-test-results.md b/__tests__/__outputs__/jest-test-results.md index 24b5309..606a367 100644 --- a/__tests__/__outputs__/jest-test-results.md +++ b/__tests__/__outputs__/jest-test-results.md @@ -1,4 +1,5 @@ -![Tests failed](https://img.shields.io/badge/tests-4207%20passed%2C%202%20failed%2C%2030%20skipped-critical) +[![Tests failed](https://img.shields.io/badge/tests-4207%20passed%2C%202%20failed%2C%2030%20skipped-critical)](#test-report) +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/external/jest/jest-test-results.xml|4207 ✅|2 ❌|30 ⚪|166s| diff --git a/__tests__/__outputs__/mocha-json.md b/__tests__/__outputs__/mocha-json.md index 7474b54..ce3058c 100644 --- a/__tests__/__outputs__/mocha-json.md +++ b/__tests__/__outputs__/mocha-json.md @@ -1,4 +1,5 @@ -![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%204%20failed%2C%201%20skipped-critical) +[![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%204%20failed%2C%201%20skipped-critical)](#test-report) +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/mocha-json.json|1 ✅|4 ❌|1 ⚪|12ms| diff --git a/__tests__/__outputs__/mocha-test-results.md b/__tests__/__outputs__/mocha-test-results.md index 4fe3802..6cbc592 100644 --- a/__tests__/__outputs__/mocha-test-results.md +++ b/__tests__/__outputs__/mocha-test-results.md @@ -1,6 +1,7 @@ -![Tests passed successfully](https://img.shields.io/badge/tests-833%20passed%2C%206%20skipped-success) +[![Tests passed successfully](https://img.shields.io/badge/tests-833%20passed%2C%206%20skipped-success)](#test-report)
Expand for details +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/external/mocha/mocha-test-results.json|833 ✅||6 ⚪|6s| diff --git a/__tests__/__outputs__/provider-test-results.md b/__tests__/__outputs__/provider-test-results.md index 36abb6e..d163b1d 100644 --- a/__tests__/__outputs__/provider-test-results.md +++ b/__tests__/__outputs__/provider-test-results.md @@ -1,4 +1,5 @@ -![Tests failed](https://img.shields.io/badge/tests-268%20passed%2C%201%20failed-critical) +[![Tests failed](https://img.shields.io/badge/tests-268%20passed%2C%201%20failed-critical)](#test-report) +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/external/flutter/provider-test-results.json|268 ✅|1 ❌||0ms| diff --git a/__tests__/__outputs__/pulsar-test-results-no-merge.md b/__tests__/__outputs__/pulsar-test-results-no-merge.md index 99539b9..57322cd 100644 --- a/__tests__/__outputs__/pulsar-test-results-no-merge.md +++ b/__tests__/__outputs__/pulsar-test-results-no-merge.md @@ -1,4 +1,5 @@ -![Tests failed](https://img.shields.io/badge/tests-1%20failed%2C%201%20skipped-critical) +[![Tests failed](https://img.shields.io/badge/tests-1%20failed%2C%201%20skipped-critical)](#test-report) +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/external/java/TEST-org.apache.pulsar.AddMissingPatchVersionTest.xml||1 ❌|1 ⚪|116ms| diff --git a/__tests__/__outputs__/pulsar-test-results.md b/__tests__/__outputs__/pulsar-test-results.md index b6d910c..f9f95d7 100644 --- a/__tests__/__outputs__/pulsar-test-results.md +++ b/__tests__/__outputs__/pulsar-test-results.md @@ -1,4 +1,5 @@ -![Tests failed](https://img.shields.io/badge/tests-793%20passed%2C%201%20failed%2C%2014%20skipped-critical) +[![Tests failed](https://img.shields.io/badge/tests-793%20passed%2C%201%20failed%2C%2014%20skipped-critical)](#test-report) +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/external/java/pulsar-test-report.xml|793 ✅|1 ❌|14 ⚪|2127s| diff --git a/__tests__/__outputs__/rspec-json.md b/__tests__/__outputs__/rspec-json.md index 88336be..0090484 100644 --- a/__tests__/__outputs__/rspec-json.md +++ b/__tests__/__outputs__/rspec-json.md @@ -1,4 +1,5 @@ -![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%201%20failed%2C%201%20skipped-critical) +[![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%201%20failed%2C%201%20skipped-critical)](#test-report) +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/rspec-json.json|1 ✅|1 ❌|1 ⚪|0ms| diff --git a/__tests__/__outputs__/silent-notes-test-results.md b/__tests__/__outputs__/silent-notes-test-results.md index 9cd23f5..cf7b8e7 100644 --- a/__tests__/__outputs__/silent-notes-test-results.md +++ b/__tests__/__outputs__/silent-notes-test-results.md @@ -1,6 +1,7 @@ -![Tests passed successfully](https://img.shields.io/badge/tests-67%20passed%2C%2012%20skipped-success) +[![Tests passed successfully](https://img.shields.io/badge/tests-67%20passed%2C%2012%20skipped-success)](#test-report)
Expand for details +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/external/SilentNotes.trx|67 ✅||12 ⚪|1s| diff --git a/__tests__/__outputs__/swift-xunit.md b/__tests__/__outputs__/swift-xunit.md index b84a926..f1f5c00 100644 --- a/__tests__/__outputs__/swift-xunit.md +++ b/__tests__/__outputs__/swift-xunit.md @@ -1,4 +1,5 @@ -![Tests failed](https://img.shields.io/badge/tests-2%20passed%2C%201%20failed-critical) +[![Tests failed](https://img.shields.io/badge/tests-2%20passed%2C%201%20failed-critical)](#test-report) +# Tests report |Report|Passed|Failed|Skipped|Time| |:---|---:|---:|---:|---:| |fixtures/swift-xunit.xml|2 ✅|1 ❌||220ms| diff --git a/dist/index.js b/dist/index.js index fa45c86..9470aba 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1845,7 +1845,7 @@ function getBadge(passed, failed, skipped, options) { } const hint = failed > 0 ? 'Tests failed' : 'Tests passed successfully'; const uri = encodeURIComponent(`${options.badgeTitle}-${message}-${color}`); - return `![${hint}](https://img.shields.io/badge/${uri})`; + return `[![${hint}](https://img.shields.io/badge/${uri})](#test-report)`; } function getTestRunsReport(testRuns, options) { const sections = []; @@ -1854,6 +1854,7 @@ function getTestRunsReport(testRuns, options) { sections.push(`
Expand for details`); sections.push(` `); } + sections.push('# Tests report'); if (testRuns.length > 0 || options.onlySummary) { const tableData = testRuns .filter(tr => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0) diff --git a/src/report/get-report.ts b/src/report/get-report.ts index 99bf270..69db4f7 100644 --- a/src/report/get-report.ts +++ b/src/report/get-report.ts @@ -138,7 +138,7 @@ function getBadge(passed: number, failed: number, skipped: number, options: Repo } const hint = failed > 0 ? 'Tests failed' : 'Tests passed successfully' const uri = encodeURIComponent(`${options.badgeTitle}-${message}-${color}`) - return `![${hint}](https://img.shields.io/badge/${uri})` + return `[![${hint}](https://img.shields.io/badge/${uri})](#test-report)` } function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): string[] { @@ -149,6 +149,8 @@ function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): s sections.push(` `) } + sections.push('# Tests report') + if (testRuns.length > 0 || options.onlySummary) { const tableData = testRuns .filter(tr => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0)