0

I have a test target defined in my Package.swift file, and this test target requires some JSON files necessary for stubbing network responses while running acceptance tests in order to run.

swift build succeeds in building the main target, and swift test similarly succeeds in building the test target, but the tests fail as the necessary resources are not found when loading them is attempted.

How can I specify that these JSON resources are required build resources when using swift build and swift test.

Here is my Package.swift file:

// swift-tools-version:4.0

import PackageDescription

let package = Package(
    name: "MyTarget",
    products: [
        .library(
          name: "MyTarget",
          targets: ["MyTarget"])
    ],
    targets: [
      .target(name: "MyTarget"),
      .testTarget(
          name: "MyTestTarget",
          dependencies: ["MyTarget"])
    ]
)
loudmouth
  • 1,946
  • 1
  • 12
  • 16
  • Managing resources with the Swift package manager is currently discussed on swift-evolution: https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170925/039907.html – Martin R Sep 29 '17 at 17:17
  • @MartinR I think it is a duplicate. How can I mark my question as a duplicate? – loudmouth Oct 01 '17 at 20:53

0 Answers0