RedditPP Mascot

RedditPP

r/swift • … • u/caustic_kiwi

Swift tour “build a library” xctest module missing

I'm trying to follow this guide https://www.swift.org/getting-started/library-swiftpm/

When I run swift test I get a no such module error for XCTest. I'm running this through the command line on an m2 Mac.

I can't find anyone having the same problem (lots of people with the same error but all in Xcode, I think). I've tried following the instructions exactly, using a different package name, and I clone the exercise repo and tried it in there without touching anything, same error every time.

Do I need to add something to my path variable? I don't see any mention of that in the guide, nor does it mention needing to use the package manager to manually download anything. It seems crazy that a 2 paragraph guide on the official swift website doesn't work on recent apple hardware... so maybe I'm just missing something obvious?

— 0