Skip to content

Commit d0aa17d

Browse files
committed
Be tolerant of empty test modules
Fixes Alamofire build. This should either be deprecated and made an error, or changed based on my forth coming No More Magic proposal.
1 parent 0411c9c commit d0aa17d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Sources/Transmute/Package+testModules.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ import Utility
1313

1414
extension Package {
1515
func testModules() throws -> [TestModule] {
16-
return try walk(path, "Tests", recursively: false).filter{ $0.isDirectory }.map { dir in
17-
return TestModule(basename: dir.basename, sources: try self.sourcify(dir))
16+
return walk(path, "Tests", recursively: false).filter{ $0.isDirectory }.flatMap { dir in
17+
if let sources = try? self.sourcify(dir) {
18+
return TestModule(basename: dir.basename, sources: sources)
19+
} else {
20+
print("warning: no sources in test module: \(path)")
21+
return nil
22+
}
1823
}
1924
}
2025
}

0 commit comments

Comments
 (0)