@@ -130,13 +130,12 @@ public class SwiftTestTool: SwiftTool<TestToolOptions> {
130
130
}
131
131
132
132
override func runImpl( ) throws {
133
- let graph = try loadPackageGraph ( )
134
-
135
133
switch options. mode {
136
134
case . version:
137
135
print ( Versioning . currentVersion. completeDisplayString)
138
136
139
137
case . listTests:
138
+ let graph = try loadPackageGraph ( )
140
139
let testPath = try buildTestsIfNeeded ( options, graph: graph)
141
140
let testSuites = try getTestSuites ( path: testPath)
142
141
let tests = testSuites. filteredTests ( specifier: options. testCaseSpecifier)
@@ -150,12 +149,14 @@ public class SwiftTestTool: SwiftTool<TestToolOptions> {
150
149
#if os(Linux)
151
150
warning ( message: " can't discover new tests on Linux; please use this option on macOS instead " )
152
151
#endif
152
+ let graph = try loadPackageGraph ( )
153
153
let testPath = try buildTestsIfNeeded ( options, graph: graph)
154
154
let testSuites = try getTestSuites ( path: testPath)
155
155
let generator = LinuxMainGenerator ( graph: graph, testSuites: testSuites)
156
156
try generator. generate ( )
157
157
158
158
case . runSerial:
159
+ let graph = try loadPackageGraph ( )
159
160
let testPath = try buildTestsIfNeeded ( options, graph: graph)
160
161
var ranSuccessfully = true
161
162
@@ -191,6 +192,7 @@ public class SwiftTestTool: SwiftTool<TestToolOptions> {
191
192
}
192
193
193
194
case . runParallel:
195
+ let graph = try loadPackageGraph ( )
194
196
let testPath = try buildTestsIfNeeded ( options, graph: graph)
195
197
let testSuites = try getTestSuites ( path: testPath)
196
198
let tests = testSuites. filteredTests ( specifier: options. testCaseSpecifier)
0 commit comments