The first test always shows up as taking more time because of the overhead involved in loading the test file, running any pre-test code, etc.
Repro
Start-Sleep -Seconds 2
Describe "Pester Test Time" {
It "Is the First Test" {
$true | Should be $true
}
It "Is the second Test" {
$true | Should be $true
}
}
Comparison
Describe "Pester Test Time without Sleeping" {
It "Is the First Test" {
$true | Should be $true
}
It "Is the second Test" {
$true | Should be $true
}
}
Results
Describing Pester Test Time
[+] Is the First Test 2.06s
[+] Is the second Test 6ms
Describing Pester Test Time without Sleeping
[+] Is the First Test 63ms
[+] Is the second Test 5ms
The first test always shows up as taking more time because of the overhead involved in loading the test file, running any pre-test code, etc.
Repro
Comparison
Results