From 3741af6fa3aecd91a46bd47cffd1f771797517a9 Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Fri, 10 Apr 2015 23:37:24 +1000 Subject: [PATCH] Implement testing using Pester Integrate with AppVeyor --- pester.json | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/pester.json b/pester.json index 192653e1ec..e37f65788b 100644 --- a/pester.json +++ b/pester.json @@ -7,19 +7,26 @@ "extract_dir": "pester-3.3.6", "bin": "bin\\pester.bat", "post_install": " - if(!(test-path $profile)) { - $profile_dir = split-path $profile - if(!(test-path $profile_dir)) { mkdir $profile_dir > $null } - '' > $profile - } - $import = \"try { `$null = gcm pester -ea stop; import-module `\"$dir\\pester.psm1`\" } catch { }\" - $text = get-content $profile - if (($text | sls 'pester') -eq $null) { - $new_profile = @($text) + $import - $new_profile > $profile - } + if($profile) { + 'adding pester to powershell profile...' + if(!(test-path $profile)) { + 'powershell profile doesn''t exist. creating...' + $profile_dir = split-path $profile + if(!(test-path $profile_dir)) { mkdir $profile_dir > $null } + '' > $profile + } + + $text = get-content $profile + if (($text | sls 'pester') -eq $null) { + $new_profile = @($text) + $import + $new_profile > $profile + success 'pester added to powershell profile.' + } + } else { warn 'no powershell profile found. the pester module will not be imported each session.' } + + 'importing pester for current session...' iex \"$import\" " }