@@ -57,38 +57,34 @@ runs:
5757 with :
5858 dotnet-version : ${{ inputs.dotnet_sdk_version }}
5959
60- - if : ${{ inputs.use-trf-logger == 'true' }}
61- name : ' Set TRX_LOGGER_ARGS environment variable'
62- shell : bash
63- run : echo "TRX_LOGGER_ARGS=--logger:trx" >> $GITHUB_ENV
64-
65- - if : ${{ inputs.collect-code-coverage == 'true' }}
66- name : ' Set CODE_COVERAGE_ARGS environment variable'
67- shell : bash
68- run : |
69- echo 'CODE_COVERAGE_ARGS=--collect:"XPlat Code Coverage"' >> $GITHUB_ENV
70-
71- - if : ${{ inputs.collect-code-coverage == 'true' && inputs.code-coverage-settings-file != ''}}
72- name : ' Set CODE_COVERAGE_ARGS environment variable'
73- shell : bash
74- run : |
75- echo "CODE_COVERAGE_ARGS=${{ env.CODE_COVERAGE_ARGS }} --settings ${{ inputs.code-coverage-settings-file }}" >> $GITHUB_ENV
76-
77- - if : ${{ inputs.collect-code-coverage == 'true'}}
78- name : ' Set CODE_COVERAGE_ARGS environment variable'
79- shell : bash
80- run : |
81- echo "CODE_COVERAGE_ARGS=${{ env.CODE_COVERAGE_ARGS }} --property:CoverletOutputFormat=${{ inputs.code-coverage-output-format}}" >> $GITHUB_ENV
82-
8360 - name : ' Test with .NET CLI'
8461 shell : bash
85- run : dotnet test ${{ inputs.project-path }} \
86- --configuration ${{ inputs.build-configuration }} \
87- ${{ env.TRX_LOGGER_ARGS }} \
88- --results-directory ${{ inputs.test-results-directory }} \
89- ${{ env.CODE_COVERAGE_ARGS }}
9062 env :
9163 DOTNET_USE_TEST_PLATFORM : ' 1'
64+ run : |
65+ ARGS=()
66+ ARGS+=("${{ inputs.project-path }}")
67+ ARGS+=(--configuration "${{ inputs.build-configuration }}")
68+ ARGS+=(--results-directory "${{ inputs.test-results-directory }}")
69+
70+ # Optional TRX logger
71+ if [[ "${{ inputs.use-trf-logger }}" == "true" ]]; then
72+ ARGS+=(--logger:trx)
73+ fi
74+
75+ # Optional code coverage logic
76+ if [[ "${{ inputs.collect-code-coverage }}" == "true" ]]; then
77+ ARGS+=(--collect:"XPlat Code Coverage")
78+
79+ if [[ -n "${{ inputs.code-coverage-settings-file }}" ]]; then
80+ ARGS+=(--settings "${{ inputs.code-coverage-settings-file }}")
81+ fi
82+
83+ ARGS+=(--property:CoverletOutputFormat="${{ inputs.code-coverage-output-format }}")
84+ fi
85+
86+ echo "Running: dotnet test ${ARGS[*]}"
87+ dotnet test "${ARGS[@]}"
9288
9389 - name : ' Upload test results'
9490 if : ${{ inputs.upload-test-artifacts == 'true' }}
0 commit comments