From b553a5db2f5c4e9ad8a052ca0d302ca67e2cc71e Mon Sep 17 00:00:00 2001 From: Danielle Adams Date: Tue, 12 Mar 2024 11:52:01 -0600 Subject: [PATCH] ARCH-2011 - Troubleshooting tests --- .github/workflows/build-and-review-pr.yml | 2 +- dist/index.js | 8 ++++---- src/reportgenerator.js | 8 ++++---- test/assert-dir-does-not-exist.sh | 3 +++ test/assert-dir-exists.sh | 3 +++ test/assert-file-contains-expected-content.sh | 4 ++-- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-and-review-pr.yml b/.github/workflows/build-and-review-pr.yml index 27da842..3e86f24 100644 --- a/.github/workflows/build-and-review-pr.yml +++ b/.github/workflows/build-and-review-pr.yml @@ -98,7 +98,7 @@ jobs: - name: '-------------------------------------------------------------------------------------------------------------' run: echo "" - name: ' SETUP ' - run: echo "" + run: mkdir -p ./test-results - name: Setup - Checkout the action uses: actions/checkout@v4 diff --git a/dist/index.js b/dist/index.js index 419107f..654e4e3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3390,7 +3390,7 @@ async function run() { if (!areReportTypesValid(reportTypes)) return; let output = ''; const toolPath = 'reportgeneratortool'; - core.info('Detecting .NET Core SDK...'); + core.info('\nDetecting .NET Core SDK...'); try { await exec.exec('dotnet', ['--version'], { listeners: { @@ -3399,7 +3399,7 @@ async function run() { } } }); - core.info(`Detected .NET Core SDK version '${output}'`); + core.info(`Detected .NET Core SDK version '${output.trim()}'`); } catch (error) { const shortMsg = 'dotnet not available'; core.setOutput('error-reason', shortMsg); @@ -3411,7 +3411,7 @@ async function run() { core.info(" dotnet-version: '8.x' # 5.0 or higher"); return; } - core.info('Installing ReportGenerator global tool...'); + core.info('\nChecking for ReportGenerator global tool...'); core.info('https://www.nuget.org/packages/dotnet-reportgenerator-globaltool'); if (fs.existsSync(toolPath)) { core.info('ReportGenerator global tool already installed'); @@ -3444,7 +3444,7 @@ async function run() { return; } } - core.info('Executing ReportGenerator'); + core.info('\nExecuting ReportGenerator'); try { let args = [ `-reports:${core.getInput('reports')}`, diff --git a/src/reportgenerator.js b/src/reportgenerator.js index f64a9b0..3c2a446 100644 --- a/src/reportgenerator.js +++ b/src/reportgenerator.js @@ -15,7 +15,7 @@ async function run() { let output = ''; const toolPath = 'reportgeneratortool'; - core.info('Detecting .NET Core SDK...'); + core.info('\nDetecting .NET Core SDK...'); try { await exec.exec('dotnet', ['--version'], { listeners: { @@ -24,7 +24,7 @@ async function run() { } } }); - core.info(`Detected .NET Core SDK version '${output}'`); + core.info(`Detected .NET Core SDK version '${output.trim()}'`); } catch (error) { const shortMsg = 'dotnet not available'; core.setOutput('error-reason', shortMsg); @@ -37,7 +37,7 @@ async function run() { return; } - core.info('Installing ReportGenerator global tool...'); + core.info('\nChecking for ReportGenerator global tool...'); core.info('https://www.nuget.org/packages/dotnet-reportgenerator-globaltool'); if (fs.existsSync(toolPath)) { core.info('ReportGenerator global tool already installed'); @@ -72,7 +72,7 @@ async function run() { } } - core.info('Executing ReportGenerator'); + core.info('\nExecuting ReportGenerator'); try { let args = [ `-reports:${core.getInput('reports')}`, diff --git a/test/assert-dir-does-not-exist.sh b/test/assert-dir-does-not-exist.sh index c56f0bd..84bd698 100755 --- a/test/assert-dir-does-not-exist.sh +++ b/test/assert-dir-does-not-exist.sh @@ -13,6 +13,9 @@ for arg in "$@"; do esac done +echo "These items exist under test-results:" +ls -r ./test-results + echo " Asserting '$dir' does not exist" diff --git a/test/assert-dir-exists.sh b/test/assert-dir-exists.sh index 3efbb3e..0dd1d20 100755 --- a/test/assert-dir-exists.sh +++ b/test/assert-dir-exists.sh @@ -13,6 +13,9 @@ for arg in "$@"; do esac done +echo "These items exist under test-results:" +ls -r ./test-results + echo " Asserting '$dir' exists" diff --git a/test/assert-file-contains-expected-content.sh b/test/assert-file-contains-expected-content.sh index 960b314..89dc7eb 100755 --- a/test/assert-file-contains-expected-content.sh +++ b/test/assert-file-contains-expected-content.sh @@ -43,11 +43,11 @@ expectedFileContents=$(cat $expectedContents) # Then print the contents echo "::group::Expected file contents" -echo "$expectedFileContents" +echo "'$expectedFileContents'" echo "::endgroup::" echo "::group::Actual file contents" -echo "$actualFileContents" +echo "'$actualFileContents'" echo "::endgroup::" # And finally compare the contents