From 28fd5512bb2f006643577d799b2d947bc9c248ed Mon Sep 17 00:00:00 2001 From: jhoneill Date: Mon, 25 Feb 2019 20:53:11 +0000 Subject: [PATCH] Fixed broken tests --- Export-Excel.ps1 | 3 +++ __tests__/Export-Excel.Tests.ps1 | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index 4fa5038..0d06f65 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -539,6 +539,9 @@ ) #The write-verbose commands have been commented out below - even if verbose is silenced they cause a significiant performance impact and if it's on they will cause a flood of messages. Switch ($CellValue) { + { $null -eq $_ } { + break + } { $_ -is [DateTime]} { # Save a date with one of Excel's built in formats format $TargetCell.Value = $_ diff --git a/__tests__/Export-Excel.Tests.ps1 b/__tests__/Export-Excel.Tests.ps1 index 4bae733..efecc35 100644 --- a/__tests__/Export-Excel.Tests.ps1 +++ b/__tests__/Export-Excel.Tests.ps1 @@ -9,7 +9,7 @@ Describe ExportExcel { $path = "$env:TEMP\Test.xlsx" Remove-item -Path $path -ErrorAction SilentlyContinue #Test with a maximum of 100 processes for speed; export all properties, then export smaller subsets. - $processes = Get-Process | select-object -first 100 -Property * -excludeProperty Parent + $processes = Get-Process | where {$_.StartTime} | Select-Object -first 100 -Property * -excludeProperty Parent $propertyNames = $Processes[0].psobject.properties.name $rowcount = $Processes.Count $Processes | Export-Excel $path #-show @@ -135,7 +135,7 @@ Describe ExportExcel { it "Created the worksheet with the expected name, number of rows and number of columns " { $ws.Name | Should be "sheet1" $ws.Dimension.Columns | Should be 1 - $ws.Dimension.Rows | Should be 12 + $ws.Dimension.End.Row | Should be 12 } it "Set the default style for the sheet as expected " {