Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Bug: Running the tests does not work on Mac OS out of the box #113

@lwb4

Description

@lwb4

Expected behavior

Following the steps in Src/Newtonsoft.Json-for-Unity.Tests/ as-is successfully guides the user to run the tests on all platforms.

(I am assuming that Mac OS is a supported platform since it is required to build iOS.)

Actual behavior

ci/local_build_into_package.ps1 works, but running the tests does not. I tried all three methods.

Running via command line

See output_unity_runtests.txt for the full output. Relevant error sections here:

Assets/Newtonsoft.Json.Tests.Aot/EnsureTypes.cs(4,23): error CS0234: The type or namespace name 'Utilities' does not exist in the namespace 'Newtonsoft.Json' (are you missing an assembly reference?)
Assets/UnityTests/HttpUtilityTests.cs(12,21): error CS0103: The name 'HttpUtility' does not exist in the current context
Assets/UnityTests/HttpUtilityTests.cs(19,21): error CS0103: The name 'HttpUtility' does not exist in the current context

Running via Unity Editor

Same errors as running via command line, but in the editor console.

Running via Docker

(This is not my main issue, as I'd like to be able to run the tests without Docker, but noting here for completeness.)

➜  Newtonsoft.Json-for-Unity git:(master) $ ci/local_test_in_unity_container.ps1 -VolumeSource $(pwd)
Resolve-Path: /Users/lincolnbergeson/Workspace/Newtonsoft.Json-for-Unity/ci/local_test_in_unity_container.ps1:49
Line |
  49 |      Resolve-Path (Join-Path "$PSScriptRoot" "Unity_v$UnityVersion.ulf …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path '/Users/lincolnbergeson/Workspace/Newtonsoft.Json-for-Unity/ci/Unity_v2019.2.11f1.ulf' because it does not
     | exist.

ls ci shows no .ulf files in that directory:

docker_build_images.ps1           local_build_into_test_project.ps1 package-builder.Dockerfile        package-unity-tester.Dockerfile
docker_publish_images.ps1         local_docker_run.ps1              package-deploy-github.Dockerfile  scripts
local_build_into_package.ps1      local_test_in_unity_container.ps1 package-deploy-npm.Dockerfile     version.json

Steps to reproduce

Full repro in a fork at https://github.com/lwb4/Newtonsoft.Json-for-Unity

First I installed the dependencies:

  • Install Powershell via Homebrew
  • Install Docker Desktop via their website
  • Install Unity version 2019.2.11f1 via Unity Hub

Then, to repro the bug:

  • Clone this repo
  • mkdir Src/Newtonsoft.Json-for-Unity.Tests/Assets/Newtonsoft.Json.Tests
  • cp -R Src/Newtonsoft.Json.Tests/* Src/Newtonsoft.Json-for-Unity.Tests/Assets/Newtonsoft.Json.Tests/ (No need to remove bin or obj folders, since none were found)
  • ci/local_build_into_package.ps1 (output attached in output_local_build_into_package_ps1.txt)
  • /Applications/Unity/Hub/Editor/2019.2.11f1/Unity.app/Contents/MacOS/Unity -runTests -batchmode -projectPath Src/Newtonsoft.Json-for-Unity.Tests -testResults results.xml -testPlatform iOS -logFile output_unity_runtests.txt

output_ci_local_build_into_package_ps1.txt
output_unity_runtests.txt

Details

Host machine OS running Unity Editor: Macbook Pro 2019 running Mac OS Big Sur Version 11.2.3

Unity build target: iOS targeted above, but the default testPlatform parameter (editmode) doesn't work either.

Newtonsoft.Json-for-Unity package version: Latest master from this repo

I was using Unity version 2019.2.11f1

Checklist

  • Shutdown Unity, deleted the /Library folder, opened project again in Unity, and problem still remains.
  • Checked to be using latest version of the package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions