We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Attachment: Download
Xcode 13 beta 2 macOS 11.4
md5: 63d25bf3a745c8b1c9e87527c1f4e9fc
Issue Description:
Sample Framework project attached. It includes resources in a testTarget via .copy, but they don't seem to be available when running the tests.
To reproduce:
Open the Package.swift file with Xcode
Select an iOS simulator as the run destination
Select Test on the Product menu.
The test fails because it can't find "astros.json", but it's in a subdirectory of "TestFiles" in "StructureCoreTests".
This may be an error on my part but I don't see where it's going wrong.
The text was updated successfully, but these errors were encountered:
@swift-ci create
Sorry, something went wrong.
There are two issues in the tests of the given package:
Package resources are part of a separate module that can be accessed using `Bundle.module`
You are copying a whole hierarchy of files, so you need a more concrete path
This diff makes the test run successfully:
diff --git a/Tests/StructureCoreTests/ImportJSONTest.swift b/Tests/StructureCoreTests/ImportJSONTest.swift index 693328c..eb5dc9b 100644 --- a/Tests/StructureCoreTests/ImportJSONTest.swift +++ b/Tests/StructureCoreTests/ImportJSONTest.swift @@ -15,8 +15,8 @@ enum ImportJSONTestError: Error { class ImportJSONTest: XCTestCase { func testReadJSONFiles() throws { - let bundle = Bundle.init(for: ImportJSONTest.self) - guard let _ = bundle.url(forResource: "astros.json", withExtension: nil) else { + let bundle = Bundle.module + guard let _ = bundle.url(forResource: "TestFiles/Data/astros.json", withExtension: nil) else { // file not found throw ImportJSONTestError.reading }
No branches or pull requests
Attachment: Download
Environment
Xcode 13 beta 2
macOS 11.4
Additional Detail from JIRA
md5: 63d25bf3a745c8b1c9e87527c1f4e9fc
Issue Description:
Sample Framework project attached. It includes resources in a testTarget via .copy, but they don't seem to be available when running the tests.
To reproduce:
Open the Package.swift file with Xcode
Select an iOS simulator as the run destination
Select Test on the Product menu.
The test fails because it can't find "astros.json", but it's in a subdirectory of "TestFiles" in "StructureCoreTests".
This may be an error on my part but I don't see where it's going wrong.
The text was updated successfully, but these errors were encountered: