@@ -842,6 +842,47 @@ final class SwiftPMBuildSystemTests: XCTestCase {
842
842
assertArgumentsContain ( aswift. pathString, arguments: arguments)
843
843
}
844
844
}
845
+
846
+ func testPackageWithDependencyWithoutResolving( ) async throws {
847
+ // This package has a dependency but we haven't run `swift package resolve`. We don't want to resolve packages from
848
+ // SourceKit-LSP because it has side-effects to the build directory.
849
+ // But even without the dependency checked out, we should be able to create a SwiftPMBuildSystem and retrieve the
850
+ // existing source files.
851
+ let project = try await SwiftPMTestProject (
852
+ files: [
853
+ " Tests/PackageTests/PackageTests.swift " : """
854
+ import Testing
855
+
856
+ 1️⃣@Test func topLevelTestPassing() {}2️⃣
857
+ """
858
+ ] ,
859
+ manifest: """
860
+ let package = Package(
861
+ name: " MyLibrary " ,
862
+ dependencies: [.package(url: " https://github.com/swiftlang/swift-testing.git " , branch: " main " )],
863
+ targets: [
864
+ .testTarget(name: " PackageTests " , dependencies: [.product(name: " Testing " , package: " swift-testing " )]),
865
+ ]
866
+ )
867
+ """
868
+ )
869
+
870
+ let tests = try await project. testClient. send ( WorkspaceTestsRequest ( ) )
871
+ XCTAssertEqual (
872
+ tests,
873
+ [
874
+ TestItem (
875
+ id: " PackageTests.topLevelTestPassing() " ,
876
+ label: " topLevelTestPassing() " ,
877
+ disabled: false ,
878
+ style: " swift-testing " ,
879
+ location: try project. location ( from: " 1️⃣ " , to: " 2️⃣ " , in: " PackageTests.swift " ) ,
880
+ children: [ ] ,
881
+ tags: [ ]
882
+ )
883
+ ]
884
+ )
885
+ }
845
886
}
846
887
847
888
private func assertArgumentsDoNotContain(
0 commit comments