You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the lib on a Windows machine and creating an instance of MockTestRunner, the test fail because of access permission when the test is launched from a drive that is not the same as the HOMEDRIVE (i.e: User home at C:\User\foo and test/code launched from F:\Source\Code) if the user doesn't have the necessary permissions on the drive from.
The problem is that the HOMEPATH environment variable is defined on Windows to the path of the user home directory without the drive (e.g.: To obtain the complete path you need %HOMEDRIVE%%HOMEPATH%). so the download directory is computed as \User\foo\azure-pipelines-task-lib\...\_downloads, which, when used, is expanded to >>F:\<<User\foo\azure-pipelines-task-lib\...\_downloads and not >>C:\<<User\foo\azure-pipelines-task-lib\...\_downloads
To fix this, I submitted the PR#1006 which replace the order of the checks to test for the USERPROFILE environment variable before HOMEPATH. #On windows machines, the former is defined to the necessary path (C:\Users\foo)
Let me know what I need to provide
Steps to reproduce
Create a Mocha test according to any tutorial . The code of the test MUST be on another drive than the user home drive (%HOMEDRIVE% environment var)
Instanciate MockTestRunner in your test
launch the test from VSCode (confirmed) from the source code directory (not on the same drive as the user home)
Please check our current Issues to see if someone already reported this https://github.com/Microsoft/azure-pipelines-task-lib/issues
Environment
azure-pipelines-task-lib version: 4.4.0
Issue Description
When using the lib on a Windows machine and creating an instance of MockTestRunner, the test fail because of access permission when the test is launched from a drive that is not the same as the HOMEDRIVE (i.e: User home at
C:\User\foo
and test/code launched fromF:\Source\Code
) if the user doesn't have the necessary permissions on the drive from.This is because the MockTestRunner instance tries to download the node.exe in the
**F:\\**Users\foo
since the download directory is inferred from the HOMEPATH environment variable.The problem is that the HOMEPATH environment variable is defined on Windows to the path of the user home directory without the drive (e.g.: To obtain the complete path you need %HOMEDRIVE%%HOMEPATH%). so the download directory is computed as
\User\foo\azure-pipelines-task-lib\...\_downloads
, which, when used, is expanded to>>F:\<<User\foo\azure-pipelines-task-lib\...\_downloads
and not>>C:\<<User\foo\azure-pipelines-task-lib\...\_downloads
To fix this, I submitted the PR #1006 which replace the order of the checks to test for the USERPROFILE environment variable before HOMEPATH. #On windows machines, the former is defined to the necessary path (C:\Users\foo)
Let me know what I need to provide
Steps to reproduce
Expected behaviour
The MockTestRunner downloads a version of node.exe in the User's home directory
Actual behaviour
The test fails before the users don't have the rights
The text was updated successfully, but these errors were encountered: