From 8e397ec1a1bbe7ee58b99aadc86fd9c1bd749637 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 1 Apr 2016 20:45:32 -0700 Subject: [PATCH] Add Start-PSxUnit function Replaces `./xunit.sh` to run xUnit tests on Linux. Pretty basic, can definitely be extended to support other flavors. --- PowerShellGitHubDev.psm1 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 4feac9cb3..131653bc4 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -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/ #