Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with UnityTestTask@1 - The "path" argument must be of type string. Received type undefined #219

Open
IanMoroney opened this issue Feb 21, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@IanMoroney
Copy link
Contributor

So, trying to use the example in the docs, and I get the error:
The "path" argument must be of type string. Received type undefined
when trying to run the task.

This is the debug output from the task:

##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]check path : /Users/user/adoagent/1/_work/_tasks/UnityTestTask_85e57e6f-cb59-4d1d-979f-dd830b51f2fa/1.5.0/task.json
##[debug]adding resource file: /Users/user/adoagent/1/_work/_tasks/UnityTestTask_85e57e6f-cb59-4d1d-979f-dd830b51f2fa/1.5.0/task.json
##[debug]system.culture=en-US
##[debug]testMode=editMode
##[debug]unityProjectPath=/Users/user/adoagent/1/_work/5/s
##[debug]testCategory=undefined
##[debug]testFilter=undefined
##[debug]testResultsPath=Test Results
##[debug]unityEditorsPathMode=unityHub
##[debug]customUnityEditorsPath=undefined
##[debug]unityVersion=undefined
The "path" argument must be of type string. Received type undefined
##[debug]task result: Failed
##[error]The "path" argument must be of type string. Received type undefined
##[debug]Processed: ##vso[task.issue type=error;]The "path" argument must be of type string. Received type undefined
##[debug]Processed: ##vso[task.complete result=Failed;]The "path" argument must be of type string. Received type undefined
Finishing: unitytest

According to the docs, there isn't an input called path.
According to the code, unity-test.ts does refer to path and it joins it with task.json. However, in the above debug output, you can see the check path running which shows a full path to the task.json, so I don't know exactly what's going wrong here.

I assume i'm not missing any required input parameter, and my build environment is fine. If i'm missing something, can you let me know what it is?

YAML:

steps:
- task: UnityTestTask@1
  name: unitytest
  inputs:
    testMode: editMode
    unityProjectPath: $(System.DefaultWorkingDirectory)
@IanMoroney
Copy link
Contributor Author

@FejZa , have you seen this issue before?

@o-litnon
Copy link
Contributor

o-litnon commented Feb 23, 2023

Upvote... same issue

@FejZa FejZa added the bug Something isn't working label Mar 24, 2023
@FejZa
Copy link
Member

FejZa commented Mar 24, 2023

#223

Looks to be the same thing. Looking into it.

@Wardy125
Copy link

Wardy125 commented May 2, 2023

Any updates on this?

@o-litnon
Copy link
Contributor

o-litnon commented May 21, 2023

unityProjectPath
is a relative path from the $(Build.SourcesDirectory) and a compile-time string. You can use a string, or compile time expansion syntax e.g. ${{variables.projectPath}}

NB: you should checkout your unity project in the pipeline... but you perhaps need to preserve the Unity Library files etc
https://github.com/o-litnon/AzurePipelineUnityTasks/blob/350f90f974d34eaf8b781921a484f203b87019e6/azure-pipelines.yml#L33

@FeldmannJR
Copy link

Found a workaround in the discord by TheRpgEngineer#6915
You have to use the GetProjectVersion task first, and then pass the version as an argument to the tasks.
Example:

- task: UnityGetProjectVersionTask@1
  name: projectversion

- task: UnityTestTask@1
  name: unitytest
  inputs:
    unityProjectPath: $(System.DefaultWorkingDirectory)
    testResultsPath: $(System.DefaultWorkingDirectory)/TestResults
    unityVersion: $(projectversion.projectVersion)
    testMode: editMode
    testCategory: '!PlayMode'

- task: UnityCMDTask@1
  name: unitycmd
  inputs:
    unityVersion: $(projectversion.projectVersion)
    unityProjectPath: $(System.DefaultWorkingDirectory)
    cmdArgs: -executeMethod FirstLight.Editor.EditorTools.BackendMenu.MoveBackendDlls

@IanMoroney
Copy link
Contributor Author

@FejZa , it doesn't look like unityVersion is a documented input for UnityTestTask, let alone a required field.
Should this be added to the docs, and now marked as a required field?

@IanMoroney
Copy link
Contributor Author

I've also updated the docs here:
Dinomite-Studios/unity-azure-pipelines-tasks-docs#17

@derekfreed
Copy link
Contributor

I’m seeing this same issue. Interestingly it works just fine on one Azure DevOps org and then fails in another with the exact same code 😐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants