From c7175767c09edc4a9a6427876049b91d1fd989b6 Mon Sep 17 00:00:00 2001 From: Marc R Kellerman <9411143+mkellerman@users.noreply.github.com> Date: Mon, 7 Jan 2019 10:54:46 -0800 Subject: [PATCH 1/2] Update azure-pipelines.yml --- azure-pipelines.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9115ae3..58b7ef1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,6 +10,9 @@ steps: - powershell: './PSTelegramAPI.bootstrap.ps1' displayName: 'Invoke Bootstrap' +- powershell: '& git clone https://github.com/ThePSAdmin/Pester.git Pester; & cd Pester; & git pull; & git checkout fix/jacocoreport; Get-Module Pester | Remove-Module; Import-Module ./Pester/Pester.psd1' + displayName: 'Install Pester fix/jacocoreport' + - powershell: 'Invoke-Build -Configuration Production -Task Test' displayName: 'Invoke Pester Tests' From 7da824e2ef9d298522e9a8100c849ab50dd119d3 Mon Sep 17 00:00:00 2001 From: Marc R Kellerman <9411143+mkellerman@users.noreply.github.com> Date: Mon, 7 Jan 2019 11:44:37 -0800 Subject: [PATCH 2/2] Test Pester fix/jacocoreport --- PSTelegramAPI.bootstrap.ps1 | 12 +++++++++++- PSTelegramAPI.build.ps1 | 2 +- Tests/PSTelegramAPI.Tests.ps1 | 3 +-- azure-pipelines.yml | 3 --- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/PSTelegramAPI.bootstrap.ps1 b/PSTelegramAPI.bootstrap.ps1 index 238fd5a..10c4379 100644 --- a/PSTelegramAPI.bootstrap.ps1 +++ b/PSTelegramAPI.bootstrap.ps1 @@ -21,4 +21,14 @@ try { Set-PSRepository PSGallery -InstallationPolicy $Policy } -$RequiredModules | Import-Module \ No newline at end of file +$RequiredModules | Import-Module + +# Install custom version of Pester +& git clone https://github.com/ThePSAdmin/Pester.git Pester; +& cd Pester; +& git pull; +& git checkout fix/jacocoreport; +& cd ..; + +Get-Module Pester | Remove-Module; +Import-Module ./Pester/Pester.psd1 diff --git a/PSTelegramAPI.build.ps1 b/PSTelegramAPI.build.ps1 index 0db3c4e..ffc0a7e 100644 --- a/PSTelegramAPI.build.ps1 +++ b/PSTelegramAPI.build.ps1 @@ -6,7 +6,7 @@ param ($Configuration = 'Development') #region Set-BuildEnvironment -Try { Set-BuildEnvironment -ErrorAction SilentlyContinue -Force } Catch { } +Try { Set-BuildEnvironment -Path '.\PSTelegramAPI' -ErrorAction SilentlyContinue -Force } Catch { } #endregion #region use the most strict mode diff --git a/Tests/PSTelegramAPI.Tests.ps1 b/Tests/PSTelegramAPI.Tests.ps1 index b5241a1..04b5351 100644 --- a/Tests/PSTelegramAPI.Tests.ps1 +++ b/Tests/PSTelegramAPI.Tests.ps1 @@ -1,4 +1,3 @@ -Try { Set-BuildEnvironment -Path "${PSScriptRoot}\.." -ErrorAction SilentlyContinue -Force } Catch { } If (-Not $ENV:TLApiId) { $ENV:TLApiId = [Environment]::GetEnvironmentVariable("TLApiId", "User") } If (-Not $ENV:TLApiHash) { $ENV:TLApiHash = [Environment]::GetEnvironmentVariable("TLApiHash", "User") } @@ -40,7 +39,7 @@ Describe 'Execute Function tests' { It 'New-TLClient: Should fail with invalid ApiHash' { { New-TLClient -ApiId $ENV:TLApiId -ApiHash $Invalid_ApiHash -PhoneNumber $Invalid_PhoneNumber } | Should -Throw "API_ID_INVALID" } - It 'New-TLClient: Should prompt for Code' { + It 'New-TLClient: Should prompt for Code' -Skip { Mock 'Read-Host' { 11111 } -ModuleName PSTelegramAPI { New-TLClient -ApiId $ENV:TLApiId -ApiHash $ENV:TLApiHash -PhoneNumber $Invalid_PhoneNumber } | Should -Throw "The numeric code used to authenticate does not match the numeric code sent by SMS/Telegram" Assert-MockCalled -CommandName Read-Host -ModuleName PSTelegramAPI -Exactly 1 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 58b7ef1..9115ae3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,9 +10,6 @@ steps: - powershell: './PSTelegramAPI.bootstrap.ps1' displayName: 'Invoke Bootstrap' -- powershell: '& git clone https://github.com/ThePSAdmin/Pester.git Pester; & cd Pester; & git pull; & git checkout fix/jacocoreport; Get-Module Pester | Remove-Module; Import-Module ./Pester/Pester.psd1' - displayName: 'Install Pester fix/jacocoreport' - - powershell: 'Invoke-Build -Configuration Production -Task Test' displayName: 'Invoke Pester Tests'