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"])
]
)