From ba06c4620fc2ca809bfba509772bc915fa5c2d74 Mon Sep 17 00:00:00 2001 From: dfinke Date: Sun, 27 May 2018 13:04:37 -0400 Subject: [PATCH] moved out of BeforeAll --- DoTests.ps1 | 7 +++---- UnitTests/ImportExcelTests/Simple.tests.ps1 | 16 ++++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/DoTests.ps1 b/DoTests.ps1 index 3428c46..b424631 100644 --- a/DoTests.ps1 +++ b/DoTests.ps1 @@ -1,9 +1,8 @@ # Get-Module -ListAvailable pester | Out-Host # return -# if ((Get-Module -ListAvailable pester) -eq $null) { -# Install-Module -Name Pester -Repository PSGallery -Force -# } +if ((Get-Module -ListAvailable pester) -eq $null) { + Install-Module -Name Pester -Repository PSGallery -Force +} -Install-Module -Name Pester -Repository PSGallery -Force Invoke-Pester -Script $PSScriptRoot\UnitTests \ No newline at end of file diff --git a/UnitTests/ImportExcelTests/Simple.tests.ps1 b/UnitTests/ImportExcelTests/Simple.tests.ps1 index d97314d..f17afee 100644 --- a/UnitTests/ImportExcelTests/Simple.tests.ps1 +++ b/UnitTests/ImportExcelTests/Simple.tests.ps1 @@ -1,12 +1,16 @@ Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 +$data = $null +$timer = Measure-Command { + $data = Import-Excel $PSScriptRoot\Simple.xlsx +} Describe "Tests" { - BeforeAll { - $data = $null - $timer = Measure-Command { - $data = Import-Excel $PSScriptRoot\Simple.xlsx - } - } + # BeforeAll { + # $data = $null + # $timer = Measure-Command { + # $data = Import-Excel $PSScriptRoot\Simple.xlsx + # } + # } It "Should have two items" { $data.count | Should be 2