@@ -19,7 +19,7 @@ async function run() {
1919 // Resolve the summary file path.
2020 // It may contain wildcards allowing the path to change between builds, such as for:
2121 // $(System.DefaultWorkingDirectory)\artifacts***$(Configuration)\testresults\coverage\cobertura.xml
22- var resolvedSummaryFile : string = resolvePathToSingleItem ( workingDirectory , summaryFileLocation ) ;
22+ var resolvedSummaryFile : string = resolvePathToSingleItem ( workingDirectory , summaryFileLocation , false ) ;
2323 if ( failIfCoverageIsEmpty && await ccUtil . isCodeCoverageFileEmpty ( resolvedSummaryFile , codeCoverageTool ) ) {
2424 throw tl . loc ( 'NoCodeCoverage' ) ;
2525 } else if ( ! tl . exist ( resolvedSummaryFile ) ) {
@@ -28,7 +28,7 @@ async function run() {
2828 // Resolve the report directory.
2929 // It may contain wildcards allowing the path to change between builds, such as for:
3030 // $(System.DefaultWorkingDirectory)\artifacts***$(Configuration)\testresults\coverage
31- var resolvedReportDirectory : string = resolvePathToSingleItem ( workingDirectory , reportDirectory ) ;
31+ var resolvedReportDirectory : string = resolvePathToSingleItem ( workingDirectory , reportDirectory , true ) ;
3232
3333 // Get any 'Additional Files' to publish as build artifacts
3434 if ( additionalFiles ) {
@@ -54,12 +54,16 @@ async function run() {
5454}
5555
5656// Resolves the specified path to a single item based on whether it contains wildcards
57- function resolvePathToSingleItem ( workingDirectory :string , pathInput : string ) : string {
57+ function resolvePathToSingleItem ( workingDirectory :string , pathInput : string , isDirectory : boolean ) : string {
5858 // Default to using the specific pathInput value
5959 var resolvedPath : string = pathInput ;
6060
61- // Does the pathInput value contain wildcards?
6261 if ( pathInput ) {
62+
63+ // Find match patterns won't work if the directory has a trailing slash
64+ if ( isDirectory && ( pathInput . endsWith ( '/' ) || pathInput . endsWith ( '\\' ) ) ) {
65+ pathInput = pathInput . slice ( 0 , - 1 ) ;
66+ }
6367 // Resolve matches of the pathInput pattern
6468 var pathMatches : string [ ] = tl . findMatch (
6569 workingDirectory ,
0 commit comments