Add Start-PSxUnit function

Replaces `./xunit.sh` to run xUnit tests on Linux. Pretty basic, can
definitely be extended to support other flavors.
This commit is contained in:
Andrew Schwartzmeyer 2016-04-01 20:45:32 -07:00
parent 067609cdce
commit 8e397ec1a1

View file

@ -213,6 +213,28 @@ function Get-PSOutput {
$script:Output
}
function Start-PSxUnit {
if ($IsWindows) {
throw "xUnit tests are only currently supported on Linux / OS X"
}
if (-Not $script:Output) {
throw '$script:Output is not defined, run Start-PSBuild'
}
$Content = Split-Path -Parent $script:Output
$Arguments = "--configuration", "Linux"
try {
Push-Location $PSScriptRoot/test/csharp
dotnet build $Arguments
Copy-Item -ErrorAction SilentlyContinue -Recurse -Path $Content/* -Include Modules,libpsl-native* -Destination "./bin/Linux/netstandardapp1.5/ubuntu.14.04-x64"
dotnet test $Arguments
if ($LASTEXITCODE -ne 0) {
throw "$LASTEXITCODE xUnit tests failed"
}
} finally {
Pop-Location
}
}
function Start-PSPackage {
# PowerShell packages use Semantic Versioning http://semver.org/
#