Skip to content

filePathSupplied(...) misbehaves when "checkout" step having "workspaceRepo = true" is used #1153

@mediawolf

Description

@mediawolf

In my Azure pipeline:

- checkout: self
  workspaceRepo: true

- task: MSBuild@1
  ...
- 
- task: VSTest@3
  inputs:
    testSelector: 'testAssemblies'
    testAssemblyVer2: '**\*Test*.dll'
    searchFolder: '$(System.DefaultWorkingDirectory)'
    vsTestVersion: '17.0'

I don't specify runSettingsFile property, which VSTest@3 sets to empty string by default. That property is resolved by VsTestV3/inputparser.ts using filePathSupplied from this library:

function filePathSupplied(name) {
    // normalize paths
    var pathValue = this.resolve(this.getPathInput(name) || '');
    var repoRoot = this.resolve(exports.getVariable('build.sourcesDirectory') || exports.getVariable('system.defaultWorkingDirectory') || '');
    var supplied = pathValue !== repoRoot;
    exports.debug(name + 'path supplied :' + supplied);
    return supplied;
}

Here are relevant environment variables:

build.sourcesDirectory=E:\Bld\A1\882\s
System.DefaultWorkingDirectory=E:\Bld\A1\882\s\my-repository

The code is checked out into $(System.DefaultWorkingDirectory). As the result, filePathSupplied returns true, which makes VSTest@3 step fail with Input validation failed with exception: Provided settings file E:\Bld\A1\882\s\my-repository, does not exist` error.

A workaround is to supply an obscure value in runSettingsFile:

- task: VSTest@3
  inputs:
    runSettingsFile: '$(Build.SourcesDirectory)'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions