Skip to content

Disable Swift Testing by default in swift package init. #7783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Sources/Commands/PackageCommands/Init.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,22 @@ extension SwiftPackageCommand {
}

let packageName = self.packageName ?? cwd.basename

// Which testing libraries should be used? XCTest is on by default,
// but Swift Testing must remain off by default until it is present
// in the Swift toolchain.
var supportedTestingLibraries = Set<BuildParameters.Testing.Library>()
if testLibraryOptions.isEnabled(.xctest) {
supportedTestingLibraries.insert(.xctest)
}
if testLibraryOptions.explicitlyEnableSwiftTestingLibrarySupport == true || testLibraryOptions.explicitlyEnableExperimentalSwiftTestingLibrarySupport == true {
supportedTestingLibraries.insert(.swiftTesting)
}

let initPackage = try InitPackage(
name: packageName,
packageType: initMode,
supportedTestingLibraries: Set(testLibraryOptions.enabledTestingLibraries),
supportedTestingLibraries: supportedTestingLibraries,
destinationPath: cwd,
installedSwiftPMConfiguration: swiftCommandState.getHostToolchain().installedSwiftPMConfiguration,
fileSystem: swiftCommandState.fileSystem
Expand Down