fastlane scan returns "source is not valid JSON" error with Xcode 15.n

41 Views Asked by At

I'm attempting to use fastlane run_tests to run our unit tests with Xcode 15.[1|2|3 Beta]. I can build the app fine for distribution, but when I run scan I get the following error:

xcodebuild -showBuildSettings -workspace Foo.xcworkspace -scheme Foo 2>&1
source is not valid JSON!
xcrun simctl CLI broken; run `xcrun simctl list runtimes` and make sure it works
xcrun simctl not working

When I run simctl, I get the following output:

== Runtimes ==
iOS 16.4 (16.4 - 20E247) - com.apple.CoreSimulator.SimRuntime.iOS-16-4
iOS 17.2 (17.2 - 21C62) - com.apple.CoreSimulator.SimRuntime.iOS-17-2
iOS 17.4 (17.4 - 21E5195d) - com.apple.CoreSimulator.SimRuntime.iOS-17-4
iOS 17.4 (17.4 - 21E5200d) - com.apple.CoreSimulator.SimRuntime.iOS-17-4

Which clearly isn't JSON. I checked with Xcode 14.3.1 as well and I get the same behavior. The fastlane version is 2.219.0.

I'm not sure what's going on, gym works fine and has the same step in it.

Here is my "tests" lane that I'm executing:

  desc "Run unit tests"
  lane :tests do
    run_tests(workspace: "Foo.xcworkspace",
              scheme: "#{SCHEME}",
              testplan: "#{SCHEME}UnitTestPlan")
  end

SCHEME is set in the environment.

I get the same errors when I execute run_tests directly.

Any thoughts on where I should dig next?

1

There are 1 best solutions below

0
David Nedrow On

Aha, I figured it out. It looks as though the simctl command has changed how it handles parameters.

Fastlane (as of 2.219.0) was calling simctl as:

xcrun simctl list runtimes -j

However, that no longer produces JSON output (-j).

After some experimentation, I found that the following DOES produce JSON output:

xcrun simctl list -j runtimes

So I forked Fastlane and contributed a PR that fixes the behavior of the Fastlane device manager.

Hopefully, there will be a 2.220.0 soon.