Don't pull testTargets during `swift package update`

Is there a way to tell spm not to pull in test-only dependencies (dependencies only used in .testTargets)?

I just ran a swift package update after adding a new dependency to my Package.swift and some of repos it cloned are for items only used in the dependencies .testTarget, and it isn't even a part of the targets listed under it products either.

Here's the dependency's Package.swift:

// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "TrailBlazer",
    products: [
        // Products define the executables and libraries produced by a package, and make them visible to other packages.
            name: "TrailBlazer",
            targets: ["TrailBlazer"]),
    dependencies: [
        .package(url: "", from: "0.4.1"),
        .package(url: "", from: "0.1.0"),
        .package(url: "", from: "0.1.0"),
        .package(url: "", from: "4.1.0"),
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
            name: "TrailBlazer",
            dependencies: ["ErrNo", "Cdirent", "Cglob"]),
            name: "TrailBlazerTests",
            dependencies: ["TrailBlazer", "SwiftShell"]),
1 Like