swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.7k stars 1.33k forks source link

[SR-15020] swift test fails on macOS without Xcode #4396

Closed 0xTim closed 3 weeks ago

0xTim commented 3 years ago
Previous ID SR-15020
Radar rdar://problem/81575974
Original Reporter @0xTim
Type Bug
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Package Manager | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 0beac16b14a45b66909ff8f25fe2b6b5

Issue Description:

When attempting to run swift test on a package on macOS without Xcode installed, it fails because it can't find the Objective-C runtime.

swift test should use the inbuilt test discovery for finding tests so behaviour of Swift is consistent across all platforms. (Note this should not affect running tests in Xcode as this can still use the Obj-C runtime

tomerd commented 3 years ago

@swift-ci create

adam-fowler commented 2 years ago

Having the option to run the xctest solution used by Linux and Windows on macOS would simplify a number of things for the Visual Studio Code Swift extension.

As a starter it would resolve SR-15997

apps4everyone commented 4 months ago

any news here?

0xTim commented 4 months ago

I think the answer is probably https://github.com/apple/swift-testing because that can be pulled in via a package and not reliant on the Obj-C runtime being installed

grynspan commented 3 weeks ago

As of the current main-branch Swift toolchain, it should be possible to run tests using Swift Testing without needing to install Xcode first (we're still working on the fine details.) I'd recommend you take a look at Swift Testing if you need to run tests on macOS without installing Xcode first.

Xcode and the Xcode Command Line Tools package are proprietary Apple software and, as such, are not part of the Swift open source project. XCTest, as included with Xcode, is also proprietary and is not available without installing Xcode.