Skip to content

Commit 1ae3edf

Browse files
glennsartirjmholt
authored andcommitted
(maint) Reinstate test filtering (#854)
Previously in commit b13bef1 the ability to filter which tests were run in order to speed up development. However in commit 449cc21 this was removed. This commit resinstates the test filtering and uses the new command line arguemnt --filter instead of the old xunit command.
1 parent f853185 commit 1ae3edf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

PowerShellEditorServices.build.ps1

+8-8
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ function UploadTestLogs {
348348
}
349349
}
350350

351-
function XunitTraitFilter {
351+
function DotNetTestFilter {
352352
# Reference https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests
353-
if ($TestFilter) { "-trait $TestFilter" } else { "" }
353+
if ($TestFilter) { @("--filter",$TestFilter) } else { "" }
354354
}
355355

356356
task Test TestServer,TestProtocol
@@ -359,23 +359,23 @@ task TestServer {
359359
Set-Location .\test\PowerShellEditorServices.Test\
360360

361361
if (-not $script:IsUnix) {
362-
exec { & $script:dotnetExe test -f $script:TestRuntime.Desktop }
362+
exec { & $script:dotnetExe test -f $script:TestRuntime.Desktop (DotNetTestFilter) }
363363
}
364364

365365
Invoke-WithCreateDefaultHook -NewModulePath $script:PSCoreModulePath {
366-
exec { & $script:dotnetExe test -f $script:TestRuntime.Core }
366+
exec { & $script:dotnetExe test -f $script:TestRuntime.Core (DotNetTestFilter) }
367367
}
368368
}
369369

370370
task TestProtocol {
371371
Set-Location .\test\PowerShellEditorServices.Test.Protocol\
372372

373373
if (-not $script:IsUnix) {
374-
exec { & $script:dotnetExe test -f $script:TestRuntime.Desktop }
374+
exec { & $script:dotnetExe test -f $script:TestRuntime.Desktop (DotNetTestFilter) }
375375
}
376376

377377
Invoke-WithCreateDefaultHook {
378-
exec { & $script:dotnetExe test -f $script:TestRuntime.Core }
378+
exec { & $script:dotnetExe test -f $script:TestRuntime.Core (DotNetTestFilter) }
379379
}
380380
}
381381

@@ -384,11 +384,11 @@ task TestHost {
384384

385385
if (-not $script:IsUnix) {
386386
exec { & $script:dotnetExe build -f $script:TestRuntime.Desktop }
387-
exec { & $script:dotnetExe test -f $script:TestRuntime.Desktop }
387+
exec { & $script:dotnetExe test -f $script:TestRuntime.Desktop (DotNetTestFilter) }
388388
}
389389

390390
exec { & $script:dotnetExe build -c $Configuration -f $script:TestRuntime.Core }
391-
exec { & $script:dotnetExe test -f $script:TestRuntime.Core }
391+
exec { & $script:dotnetExe test -f $script:TestRuntime.Core (DotNetTestFilter) }
392392
}
393393

394394
task CITest ?Test, {

0 commit comments

Comments
 (0)