Skip to content

Test time is not accurate for first test #287

@ghostsquad

Description

@ghostsquad

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions