Resolved.
Run XCTestCase-using tests in Swift on my Mac with swift test
.
When I do so, I get the error error: cannot load underlying module for 'XCTest'
Go into Xcode, then Preferences -> Locations -> Command Line Tools, and select a version of command line tools.
$ swift test
Compile Swift Module 'HelloTests' (1 sources)
/Users/jml/src/hello/Tests/HelloTests/HelloTests.swift:1:8: error: cannot load underlying module for 'XCTest'
import XCTest
^
error: terminated(1): /Library/Developer/Toolchains/swift-4.1.3-RELEASE.xctoolchain/usr/bin/swift-build-tool -f /Users/jml/src/hello/.build/debug.yaml test output:
- I've got a long habit of running things from the command-line
- documentation for swift-nio implies that it should just work
- I don't want to learn xCode at the same time as Swift, if I can avoid it
The above is more or less a summary, but I've tried running swift test
with both the system-provided swift
binary at /usr/bin/swift
, and the one installed by the 4.1.3 release at swift.org.
The first thing I tried was running swift test
on swift-nio, but that failed with the same error.
Once that happened, I tried a minimal example.
I've asked on #swift-lang on Freenode with minimal success. I've also asked on #swift-linux (on advice from #swift-lang) with no response yet.
Selecting the location of the command-line tools within the Xcode UI, as per this email thread.
I'm pretty sure I've stumbled across advice that said to be sure that Xcode Command Line Tools were installed, but I had thought they were installed.
I thought so, because whenever I tried to install them I was told they were installed:
$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates