@@ -17,10 +17,12 @@ static async Task Main(string[] args)
17
17
if ( args . Length == 0 )
18
18
{
19
19
var assemblyPath = new Uri ( Assembly . GetEntryAssembly ( ) . Location ) . AbsolutePath ;
20
- var testsPath = Path . GetFullPath ( Path . Combine ( Path . GetDirectoryName ( assemblyPath ) , ".." , ".." , ".." , ".." , ".." , "tests" ) ) ;
20
+ var solutionPath = Path . GetFullPath ( Path . Combine ( Path . GetDirectoryName ( assemblyPath ) , ".." , ".." , ".." , ".." , ".." ) ) ;
21
+ Console . Write ( "Building..." ) ;
22
+ await RunDotnetAsync ( "build -c Release" , solutionPath ) ;
21
23
22
24
Console . Write ( "Running tests" ) ;
23
-
25
+ var testsPath = Path . Combine ( solutionPath , "tests" ) ;
24
26
testResultPaths = ( await Task . WhenAll ( Directory . GetDirectories ( testsPath )
25
27
. Where ( x => x [ 0 ] != '.' )
26
28
. Select ( RunTestsAsync ) ) )
@@ -144,7 +146,7 @@ private static async Task<string> RunTestsAsync(string testFolder)
144
146
145
147
while ( true )
146
148
{
147
- await RunXunitAsync ( testFolder , outputXmlPath ) . ConfigureAwait ( false ) ;
149
+ await RunDotnetAsync ( $ "test -c Release --no-build --logger \" trx;LogFileName= { outputXmlPath } \" " , testFolder ) . ConfigureAwait ( false ) ;
148
150
Console . Write ( "." ) ;
149
151
var actualOutputPath = outputDirectory . GetFiles ( "output*.trx" ) . Select ( x => x . FullName ) . FirstOrDefault ( ) ;
150
152
if ( actualOutputPath is null )
@@ -192,18 +194,18 @@ private static (string Category, string Name, IReadOnlyDictionary<string, TestRe
192
194
return ( ( category , name , testResults ) ) ;
193
195
}
194
196
195
- private static Task RunXunitAsync ( string testFolder , string outputXmlPath )
197
+ private static Task RunDotnetAsync ( string arguments , string workingDirectory )
196
198
{
197
199
var taskCompletionSource = new TaskCompletionSource < object > ( ) ;
198
200
var process = new Process
199
201
{
200
202
StartInfo =
201
203
{
202
204
FileName = "dotnet" ,
203
- Arguments = $ "test -c Release --logger \" trx;LogFileName= { outputXmlPath } \" " ,
205
+ Arguments = arguments ,
204
206
CreateNoWindow = true ,
205
207
UseShellExecute = false ,
206
- WorkingDirectory = testFolder ,
208
+ WorkingDirectory = workingDirectory ,
207
209
} ,
208
210
EnableRaisingEvents = true ,
209
211
} ;
0 commit comments