PageSourceSearch

https://pester.dev/assets/js/6c2b490a.0f438767.js

js pester.dev collected 2026-10-03 19:36:29 UTC 35,624 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkpester_docs=self.webpackChunkpester_docs||[]).push([["1839"],{4774(e,s,r){r.r(s),r.d(s,{metadata:()=>n,default:()=>a,frontMatter:()=>i,contentTitle:()=>l,toc:()=>o,assets:()=>c});var n=JSON.parse('{"id":"usage/result-object","title":"The Result Object","description":"Pester can return a rich result object describing the whole run - containers, blocks, tests, counts, durations and errors. Learn its shape and how it behaves under the experimental parallel runner.","source":"@site/docs/usage/result-object.mdx","sourceDirName":"usage","slug":"/usage/result-object","permalink":"/docs/usage/result-object","draft":false,"unlisted":false,"editUrl":"https://github.com/pester/docs/edit/main/docs/usage/result-object.mdx","tags":[],"version":"current","frontMatter":{"id":"result-object","title":"The Result Object","sidebar_label":"Result Object","description":"Pester can return a rich result object describing the whole run - containers, blocks, tests, counts, durations and errors. Learn its shape and how it behaves under the experimental parallel runner."},"sidebar":"docs","previous":{"title":"Output","permalink":"/docs/usage/output"},"next":{"title":"Visual Studio Code","permalink":"/docs/usage/vscode"}}'),t=r(1987),d=r(7008);let i={id:"result-object",title:"The Result Object",sidebar_label:"Result Object",description:"Pester can return a rich result object describing the whole run - containers, blocks, tests, counts, durations and errors. Learn its shape and how it behaves under the experimental parallel runner."},l,c={},o=[{value:"Shape",id:"shape",level:2},{value:"Run",id:"run",level:2},{value:"Result values",id:"result-values",level:3},{value:"Container",id:"container",level:2},{value:"Block",id:"block",level:2},{value:"Test",id:"test",level:2},{value:"Errors",id:"errors",level:3},{value:"Durations",id:"durations",level:2},{value:"Parallel runner edge cases",id:"parallel-runner-edge-cases",level:2},{value:"Durations no longer add up",id:"durations-no-longer-add-up",level:3},{value:"Container order is preserved, not finish order",id:"container-order-is-preserved-not-finish-order",level:3},{value:"When the run falls back to sequential",id:"when-the-run-falls-back-to-sequential",level:3},{value:"Code coverage is not merged yet",id:"code-coverage-is-not-merged-yet",level:3},{value:"Opting a file out with <code>#pester:no-parallel</code>",id:"opting-a-file-out-with-pesterno-parallel",level:3},{value:"Each file is discovered in isolation",id:"each-file-is-discovered-in-isolation",level:3},{value:"Stable vs. internal properties",id:"stable-vs-internal-properties",level:2}];function h(e){let s={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,d.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(s.p,{children:["When you run Pester with ",(0,t.jsx)(s.code,{children:"-PassThru"})," (or ",(0,t.jsx)(s.code,{children:"Run.PassThru = $true"}),") it returns a single ",(0,t.jsx)(s.strong,{children:"result object"})," that describes the whole run: every container, block and test, with their results, counts, durations and errors. This is the same in-memory object Pester builds internally and then uses to render console output and to export the ",(0,t.jsx)(s.a,{href:"./test-results",children:"NUnit/JUnit reports"})," - ",(0,t.jsx)(s.code,{children:"-PassThru"})," simply hands it back to you so you can inspect or post-process it yourself."]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-powershell",children:"$result = Invoke-Pester -Path ./tests -PassThru\n$result.Result        # Passed / Failed\n$result.FailedCount   # number of failed tests\n"})}),"\n",(0,t.jsxs)(s.p,{children:["With the ",(0,t.jsx)(s.a,{href:"./configuration#advanced-interface",children:"advanced interface"})," the same object is returned when ",(0,t.jsx)(s.code,{children:"Run.PassThru"})," is enabled:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-powershell",children:"$config = New-PesterConfiguration\n$config.Run.Path = './tests'\n$config.Run.PassThru = $true\n$config.Output.Verbosity = 'None'   # often paired with PassThru for custom post-processing\n\n$result = Invoke-Pester -Configuration $config\n"})}),"\n",(0,t.jsx)(s.admonition,{type:"tip",children:(0,t.jsxs)(s.p,{children:["Set ",(0,t.jsx)(s.code,{children:"Output.Verbosity = 'None'"})," when you only care about the object and want to do your own reporting. Error details are always available on the object even when console output is suppressed."]})}),"\n",(0,t.jsx)(s.h2,{id:"shape",children:"Shape"}),"\n",(0,t.jsxs)(s.p,{children:["The object is a tree. A ",(0,t.jsx)(s.code,{children:"Run"})," contains one ",(0,t.jsx)(s.code,{children:"Container"})," per test file (or script block), each container contains ",(0,t.jsx)(s.code,{children:"Blocks"})," (your ",(0,t.jsx)(s.code,{children:"Describe"}),"/",(0,t.jsx)(s.code,{children:"Context"}),"), blocks can contain nested blocks, and the leaves are ",(0,t.jsx)(s.code,{children:"Tests"})," (your ",(0,t.jsx)(s.code,{children:"It"}),")."]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{children:'Run                                      (Pester.Run)\n\u251C\u2500 Container: Get-Emoji.Tests.ps1        (Pester.Container)\n\u2502  \u2514\u2500 Block: Describe "Get-Emoji"        (Pester.Block)\n\u2502     \u251C\u2500 Block: Context "cactus"         (Pester.Block)\n\u2502     \u2502  \u2514\u2500 Test: It "returns a value"   (Pester.Test)\n\u2502     \u2514\u2500 Test: It "is not empty"         (Pester.Test)\n\u2514\u2500 Container: Get-Planet.Tests.ps1\n   \u2514\u2500 Block: Describe "Get-Planet"\n      \u2514\u2500 Test: It "returns a planet"\n'})}),"\n",(0,t.jsxs)(s.p,{children:["For convenience the ",(0,t.jsx)(s.code,{children:"Run"})," also exposes ",(0,t.jsx)(s.strong,{children:"flat"})," collections that cut across the tree, so you rarely have to walk it by hand:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-powershell",children:"$result.Tests          # every test, regardless of nesting\n$result.Failed         # only the failed tests\n$result.Containers     # the per-file containers, in discovery order\n"})}),"\n",(0,t.jsx)(s.h2,{id:"run",children:"Run"}),"\n",(0,t.jsxs)(s.p,{children:["The root object, type ",(0,t.jsx)(s.code,{children:"Pester.Run"}),". Calling ",(0,t.jsx)(s.code,{children:"ToString()"})," (or just printing it) renders the result marker, e.g. ",(0,t.jsx)(s.code,{children:"[+] Pester"})," for a passed run and ",(0,t.jsx)(s.code,{children:"[-] Pester"})," for a failed one."]}),"\n",(0,t.jsx)("div",{className:"table-wrapper",children:(0,t.jsxs)(s.table,{children:[(0,t.jsx)(s.thead,{children:(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.th,{children:"Property"}),(0,t.jsx)(s.th,{children:"Type"}),(0,t.jsx)(s.th,{children:"Description"})]})}),(0,t.jsxs)(s.tbody,{children:[(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Result"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsxs)(s.td,{children:["Overall result, ",(0,t.jsx)(s.code,{children:"Passed"})," or ",(0,t.jsx)(s.code,{children:"Failed"})," (",(0,t.jsx)(s.code,{children:"NotRun"})," before execution)."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Tests"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Test[]"})}),(0,t.jsx)(s.td,{children:"Every test in the run, flattened."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Passed / Failed / Skipped / Inconclusive / NotRun"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Test[]"})}),(0,t.jsx)(s.td,{children:"Tests grouped by result."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Containers"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Container[]"})}),(0,t.jsx)(s.td,{children:"One per test file or script block, in discovery order."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"FailedBlocks"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Block[]"})}),(0,t.jsxs)(s.td,{children:["Blocks that failed in setup/teardown (e.g. a failing ",(0,t.jsx)(s.code,{children:"BeforeAll"}),")."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"FailedContainers"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Container[]"})}),(0,t.jsx)(s.td,{children:"Containers that failed during discovery or container-level setup."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"TotalCount"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"int"})}),(0,t.jsx)(s.td,{children:"Total number of tests."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"PassedCount / FailedCount / SkippedCount / InconclusiveC
1ount / NotRunCount"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"int"})}),(0,t.jsx)(s.td,{children:"Counts per result."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"FailedBlocksCount / FailedContainersCount"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"int"})}),(0,t.jsx)(s.td,{children:"Counts of failed blocks/containers."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Duration"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"TimeSpan"})}),(0,t.jsxs)(s.td,{children:["Total run duration. See ",(0,t.jsx)(s.a,{href:"#durations",children:"Durations"})," - this is wall-clock time in a parallel run."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"UserDuration"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"TimeSpan"})}),(0,t.jsx)(s.td,{children:"Time spent in your code (tests, setup, teardown)."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"FrameworkDuration"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"TimeSpan"})}),(0,t.jsx)(s.td,{children:"Time spent in Pester itself."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"DiscoveryDuration"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"TimeSpan"})}),(0,t.jsx)(s.td,{children:"Time spent discovering tests."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Executed"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"bool"})}),(0,t.jsxs)(s.td,{children:["Whether the run executed (",(0,t.jsx)(s.code,{children:"$false"})," when ",(0,t.jsx)(s.code,{children:"Run.SkipRun"})," is used)."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ExecutedAt"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"DateTime"})}),(0,t.jsx)(s.td,{children:"When the run started."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"CodeCoverage"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"CodeCoverage"})}),(0,t.jsxs)(s.td,{children:["Coverage summary when ",(0,t.jsx)(s.code,{children:"CodeCoverage.Enabled"})," is set, otherwise ",(0,t.jsx)(s.code,{children:"$null"}),". See ",(0,t.jsx)(s.a,{href:"./code-coverage",children:"Code Coverage"}),"."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Configuration"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"PesterConfiguration"})}),(0,t.jsx)(s.td,{children:"The effective configuration used for the run."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Version"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsxs)(s.td,{children:["Pester version, e.g. ",(0,t.jsx)(s.code,{children:"6.0.0"}),"."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"PSVersion"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Version"})}),(0,t.jsx)(s.td,{children:"The PowerShell version that ran the tests."})]})]})]})}),"\n",(0,t.jsx)(s.h3,{id:"result-values",children:"Result values"}),"\n",(0,t.jsxs)(s.p,{children:["Every container, block and test carries a ",(0,t.jsx)(s.code,{children:"Result"})," string. Tests use the full set; blocks and containers never report ",(0,t.jsx)(s.code,{children:"Inconclusive"}),"; the ",(0,t.jsx)(s.code,{children:"Run"})," itself is only ever ",(0,t.jsx)(s.code,{children:"Passed"}),", ",(0,t.jsx)(s.code,{children:"Failed"})," or ",(0,t.jsx)(s.code,{children:"NotRun"}),"."]}),"\n",(0,t.jsx)("div",{className:"table-wrapper",children:(0,t.jsxs)(s.table,{children:[(0,t.jsx)(s.thead,{children:(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.th,{children:"Result"}),(0,t.jsx)(s.th,{style:{textAlign:"center"},children:"Marker"}),(0,t.jsx)(s.th,{children:"Applies to"})]})}),(0,t.jsxs)(s.tbody,{children:[(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Passed"})}),(0,t.jsx)(s.td,{style:{textAlign:"center"},children:(0,t.jsx)(s.code,{children:"[+]"})}),(0,t.jsx)(s.td,{children:"Run, Container, Block, Test"})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Failed"})}),(0,t.jsx)(s.td,{style:{textAlign:"center"},children:(0,t.jsx)(s.code,{children:"[-]"})}),(0,t.jsx)(s.td,{children:"Run, Container, Block, Test"})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Skipped"})}),(0,t.jsx)(s.td,{style:{textAlign:"center"},children:(0,t.jsx)(s.code,{children:"[!]"})}),(0,t.jsx)(s.td,{children:"Container, Block, Test"})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Inconclusive"})}),(0,t.jsx)(s.td,{style:{textAlign:"center"},children:(0,t.jsx)(s.code,{children:"[?]"})}),(0,t.jsx)(s.td,{children:"Test"})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"NotRun"})}),(0,t.jsx)(s.td,{style:{textAlign:"center"},children:(0,t.jsx)(s.code,{children:"[ ]"})}),(0,t.jsx)(s.td,{children:"Run, Container, Block, Test"})]})]})]})}),"\n",(0,t.jsx)(s.h2,{id:"container",children:"Container"}),"\n",(0,t.jsxs)(s.p,{children:["Type ",(0,t.jsx)(s.code,{children:"Pester.Container"}),". One per test file or script block."]}),"\n",(0,t.jsx)("div",{className:"table-wrapper",children:(0,t.jsxs)(s.table,{children:[(0,t.jsx)(s.thead,{children:(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.th,{children:"Property"}),(0,t.jsx)(s.th,{children:"Type"}),(0,t.jsx)(s.th,{children:"Description"})]})}),(0,t.jsxs)(s.tbody,{children:[(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Name"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsx)(s.td,{children:"Friendly name - the file path for a file, or a label for a script block."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Type"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsxs)(s.td,{children:[(0,t.jsx)(s.code,{children:"File"})," or ",(0,t.jsx)(s.code,{children:"ScriptBlock"}),"."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Item"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"object"})}),(0,t.jsxs)(s.td,{children:["The underlying ",(0,t.jsx)(s.code,{children:"FileInfo"})," (for files) or ",(0,t.jsx)(s.code,{children:"ScriptBlock"}),"."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Data"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"object"})}),(0,t.jsxs)(s.td,{children:["The ",(0,t.jsx)(s.code,{children:"-Data"})," passed via ",(0,t.jsx)(s.code,{children:"New-PesterContainer"}),", available to the file's ",(0,t.jsx)(s.code,{children:"param()"})," block."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Result"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsxs)(s.td,{children:["Container result, see ",(0,t.jsx)(s.a,{href:"#result-values",children:"Result values"}),"."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Passed"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"bool"})}),(0,t.jsxs)(s.td,{children:[(0,t.jsx)(s.code,{children:"$true"})," when nothing in the container failed."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Blocks"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Block[]"})}),(0,t.jsx)(s.td,{children:"The top-level blocks in this container."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ErrorRecord"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"object[]"})}),(0,t.jsx)(s.td,{children:"Errors raised at container level, e.g. a parse error or a failed top-level setup."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"TotalCount / PassedCount / FailedCount / SkippedCount / InconclusiveC
1ount / NotRunCount"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"int"})}),(0,t.jsx)(s.td,{children:"Counts for tests in this container."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Duration / UserDuration / FrameworkDuration / DiscoveryDuration"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"TimeSpan"})}),(0,t.jsx)(s.td,{children:"Timings for this container."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ShouldRun / Skip / Executed"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"bool"})}),(0,t.jsx)(s.td,{children:"Whether the container was selected, skipped, and ultimately executed."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ExecutedAt"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"DateTime"})}),(0,t.jsx)(s.td,{children:"When the container started running."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"StandardOutput"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"object"})}),(0,t.jsx)(s.td,{children:"Output produced by the container that Pester captured."})]})]})]})}),"\n",(0,t.jsx)(s.h2,{id:"block",children:"Block"}),"\n",(0,t.jsxs)(s.p,{children:["Type ",(0,t.jsx)(s.code,{children:"Pester.Block"}),". Represents a ",(0,t.jsx)(s.code,{children:"Describe"})," or ",(0,t.jsx)(s.code,{children:"Context"}),". Blocks can nest, so a block holds both child ",(0,t.jsx)(s.code,{children:"Blocks"})," and ",(0,t.jsx)(s.code,{children:"Tests"}),"."]}),"\n",(0,t.jsx)("div",{className:"table-wrapper",children:(0,t.jsxs)(s.table,{children:[(0,t.jsx)(s.thead,{children:(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.th,{children:"Property"}),(0,t.jsx)(s.th,{children:"Type"}),(0,t.jsx)(s.th,{children:"Description"})]})}),(0,t.jsxs)(s.tbody,{children:[(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Name"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsx)(s.td,{children:"The block name as written."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ExpandedName"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsxs)(s.td,{children:["The name with ",(0,t.jsx)(s.code,{children:"<...>"})," data placeholders expanded (for data-driven blocks)."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Path"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string[]"})}),(0,t.jsx)(s.td,{children:"Names from the root block down to this one."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ExpandedPath"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsx)(s.td,{children:"The path joined with the expanded names."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Result"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsxs)(s.td,{children:["Block result, see ",(0,t.jsx)(s.a,{href:"#result-values",children:"Result values"}),"."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Passed"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"bool"})}),(0,t.jsxs)(s.td,{children:[(0,t.jsx)(s.code,{children:"$true"})," when the block and everything in it passed."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Blocks"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Block[]"})}),(0,t.jsx)(s.td,{children:"Nested blocks."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Tests"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"Test[]"})}),(0,t.jsx)(s.td,{children:"Tests directly inside this block."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ErrorRecord"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"object[]"})}),(0,t.jsxs)(s.td,{children:["Errors from this block's setup/teardown (",(0,t.jsx)(s.code,{children:"BeforeAll"}),"/",(0,t.jsx)(s.code,{children:"AfterAll"}),", etc.)."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Tag"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string[]"})}),(0,t.jsx)(s.td,{children:"Tags applied to the block."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Skip"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"bool"})}),(0,t.jsx)(s.td,{children:"Whether the block was skipped."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"TotalCount / PassedCount / FailedCount / SkippedCount / InconclusiveC
1ount / NotRunCount"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"int"})}),(0,t.jsx)(s.td,{children:"Counts for all tests under this block (including nested)."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Own*Count"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"int"})}),(0,t.jsx)(s.td,{children:"The same counts but only for tests directly in this block, excluding nested blocks."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Duration / UserDuration / FrameworkDuration / DiscoveryDuration"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"TimeSpan"})}),(0,t.jsx)(s.td,{children:"Timings for the block."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"StartLine"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"int"})}),(0,t.jsx)(s.td,{children:"Line where the block is declared."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"StandardOutput"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"object"})}),(0,t.jsx)(s.td,{children:"Output Pester captured for this block."})]})]})]})}),"\n",(0,t.jsx)(s.h2,{id:"test",children:"Test"}),"\n",(0,t.jsxs)(s.p,{children:["Type ",(0,t.jsx)(s.code,{children:"Pester.Test"}),". Represents a single ",(0,t.jsx)(s.code,{children:"It"}),"."]}),"\n",(0,t.jsx)("div",{className:"table-wrapper",children:(0,t.jsxs)(s.table,{children:[(0,t.jsx)(s.thead,{children:(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.th,{children:"Property"}),(0,t.jsx)(s.th,{children:"Type"}),(0,t.jsx)(s.th,{children:"Description"})]})}),(0,t.jsxs)(s.tbody,{children:[(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Name"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsx)(s.td,{children:"The test name as written."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ExpandedName"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsxs)(s.td,{children:["The name with ",(0,t.jsx)(s.code,{children:"<...>"})," data placeholders expanded."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Path"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string[]"})}),(0,t.jsx)(s.td,{children:"Names from the root block down to and including this test."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ExpandedPath"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsx)(s.td,{children:"The path joined with expanded names."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Result"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string"})}),(0,t.jsxs)(s.td,{children:["Test result, see ",(0,t.jsx)(s.a,{href:"#result-values",children:"Result values"}),"."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Passed / Skipped / Inconclusive"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"bool"})}),(0,t.jsxs)(s.td,{children:["Convenience flags matching ",(0,t.jsx)(s.code,{children:"Result"}),"."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ErrorRecord"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"object[]"})}),(0,t.jsxs)(s.td,{children:["Failure details. See ",(0,t.jsx)(s.a,{href:"#errors",children:"Errors"}),"."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Data"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"object"})}),(0,t.jsxs)(s.td,{children:["The ",(0,t.jsx)(s.code,{children:"-ForEach"}),"/",(0,t.jsx)(s.code,{children:"-TestCases"})," data item bound to this test."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Duration / UserDuration / FrameworkDuration"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"TimeSpan"})}),(0,t.jsx)(s.td,{children:"Timings for the test."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Tag"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"string[]"})}),(0,t.jsx)(s.td,{children:"Tags applied to the test."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Skip"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"bool"})}),(0,t.jsx)(s.td,{children:"Whether the test was skipped."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ShouldRun / Executed"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"bool"})}),(0,t.jsx)(s.td,{children:"Whether the test was selected, and whether it actually ran."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"ExecutedAt"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"DateTime?"})}),(0,t.jsxs)(s.td,{children:["When the test ran (",(0,t.jsx)(s.code,{children:"$null"})," if it did not run)."]})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"StartLine"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"int"})}),(0,t.jsx)(s.td,{children:"Line where the test is declared."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"StandardOutput"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"object"})}),(0,t.jsx)(s.td,{children:"Output the test wrote that Pester captured."})]}),(0,t.jsxs)(s.tr,{children:[(0,t.jsx)(s.td,{children:"Block"}),(0,t.jsx)(s.td,{children:(0,t.jsx)(s.code,{children:"object"})}),(0,t.jsx)(s.td,{children:"The parent block."})]})]})]})}),"\n",(0,t.jsx)(s.h3,{id:"errors",children:"Errors"}),"\n",(0,t.jsxs)(s.p,{children:["When a test or block fails, the details are in its ",(0,t.jsx)(s.code,{children:"ErrorRecord"})," collection - even if you suppressed console output with a lower ",(0,t.jsx)(s.code,{children:"Output.Verbosity"}),". Each error is a standard ",(0,t.jsx)(s.code,{children:"ErrorRecord"})," with two extra note properties Pester adds for convenience:"]}
1),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:[(0,t.jsx)(s.code,{children:"DisplayErrorMessage"})," - the formatted message Pester would print."]}),"\n",(0,t.jsxs)(s.li,{children:[(0,t.jsx)(s.code,{children:"DisplayStackTrace"})," - the filtered stack trace."]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-powershell",children:'foreach ($test in $result.Failed) {\n    "{0} -> {1}" -f $test.ExpandedPath, $test.ErrorRecord[0].DisplayErrorMessage\n}\n'})}),"\n",(0,t.jsx)(s.h2,{id:"durations",children:"Durations"}),"\n",(0,t.jsxs)(s.p,{children:["Every level reports four timings. The total ",(0,t.jsx)(s.code,{children:"Duration"})," is the sum of the three phases:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{children:"Duration = DiscoveryDuration + UserDuration + FrameworkDuration\n"})}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:[(0,t.jsx)(s.strong,{children:"UserDuration"})," - time spent in your code: tests, ",(0,t.jsx)(s.code,{children:"BeforeAll"}),", ",(0,t.jsx)(s.code,{children:"AfterEach"}),", and so on."]}),"\n",(0,t.jsxs)(s.li,{children:[(0,t.jsx)(s.strong,{children:"FrameworkDuration"})," - time Pester spent on its own bookkeeping."]}),"\n",(0,t.jsxs)(s.li,{children:[(0,t.jsx)(s.strong,{children:"DiscoveryDuration"})," - time spent discovering tests before running them."]}),"\n"]}),"\n",(0,t.jsxs)(s.p,{children:["In a normal sequential run the ",(0,t.jsx)(s.code,{children:"Run.Duration"})," equals the sum of its container durations, which in turn equals the sum of the three phase totals. As you will see next, ",(0,t.jsx)(s.strong,{children:"that relationship changes under the parallel runner."})]}),"\n",(0,t.jsx)(s.h2,{id:"parallel-runner-edge-cases",children:"Parallel runner edge cases"}),"\n",(0,t.jsx)(s.admonition,{title:"Experimental",type:"warning",children:(0,t.jsxs)(s.p,{children:["The parallel runner is ",(0,t.jsx)(s.strong,{children:"experimental"})," in Pester 6 and its behaviour may still change. It requires ",(0,t.jsx)(s.strong,{children:"PowerShell 7.4+"}),"."]})}),"\n",(0,t.jsxs)(s.p,{children:["Pester 6 can run each test ",(0,t.jsx)(s.strong,{children:"file"})," in its own runspace using ",(0,t.jsx)(s.code,{children:"ForEach-Object -Parallel"}),". Enable it with:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-powershell",children:"$config = New-PesterConfiguration\n$config.Run.Path = './tests'\n$config.Run.Parallel = $true\n$config.Run.PassThru = $true\n# Optional: cap how many files run at once (default 0 = all processors)\n$config.Run.ParallelThrottleLimit = 4\n\n$result = Invoke-Pester -Configuration $config\n"})}),"\n",(0,t.jsxs)(s.p,{children:["The good news is that ",(0,t.jsx)(s.strong,{children:"the result object has the exact same shape"})," as a sequential run. Each file is executed by a full (silent) Pester run inside a worker runspace, and the parent merges the executed containers back into one ",(0,t.jsx)(s.code,{children:"Run"}),", computing the counts, collections and overall ",(0,t.jsx)(s.code,{children:"Result"})," the same way it does sequentially. The points below are the things that genuinely differ."]}),"\n",(0,t.jsx)(s.h3,{id:"durations-no-longer-add-up",children:"Durations no longer add up"}),"\n",(0,t.jsx)(s.p,{children:"This is the most important difference. Because files overlap in time, summing their durations would overstate how long the run actually took. So in a parallel run:"}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:[(0,t.jsxs)(s.strong,{children:[(0,t.jsx)(s.code,{children:"Run.Duration"})," is the wall-clock elapsed time"]})," of the whole run (",(0,t.jsx)(s.code,{children:"Now - ExecutedAt"}),"), not the sum of the container durations."]}),"\n",(0,t.jsxs)(s.li,{children:["**",(0,t.jsx)(s.code,{children:"Run.UserDuration"}),", ",(0,t.jsx)(s.code,{children:"Run.FrameworkDuration"})," and ",(0,t.jsx)(s.code,{children:"Run.DiscoveryDuration"})," are set to zero. Phase durations are still available per container, block and test."]}),"\n"]}),"\n",(0,t.jsx)(s.h3,{id:"container-order-is-preserved-not-finish-order",children:"Container order is preserved, not finish order"}),"\n",(0,t.jsxs)(s.p,{children:["Workers finish in an unpredictable order, but Pester ",(0,t.jsx)(s.strong,{children:"restores the original discovery order"})," of ",(0,t.jsx)(s.code,{children:"Run.Containers"})," (and of the replayed console output) so the object is deterministic regardless of which file finished first."]}),"\n",(0,t.jsx)(s.h3,{id:"when-the-run-falls-back-to-sequential",children:"When the run falls back to sequential"}),"\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"Run.Parallel"})," only parallelizes ",(0,t.jsx)(s.strong,{children:"file-based"})," runs. Pester prints a warning and runs sequentially - producing an ordinary sequential result object - when any of these apply:"]}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["Running on ",(0,t.jsx)(s.strong,{children:"Windows PowerShell 5.1"})," (parallel needs PowerShell 7.4+)."]}),"\n",(0,t.jsxs)(s.li,{children:["The run uses ",(0,t.jsxs)(s.strong,{children:["script-block or ",(0,t.jsx)(s.code,{children:"ContainerInfo"})," containers"]})," rather than files."]}),"\n",(0,t.jsxs)(s.li,{children:[(0,t.jsx)(s.strong,{children:"Code 
1coverage is enabled"})," (see below)."]}),"\n",(0,t.jsxs)(s.li,{children:[(0,t.jsx)(s.strong,{children:(0,t.jsx)(s.code,{children:"Run.SkipRemainingOnFailure = 'Run'"})}),' is set, because "stop the whole run on the first failure" cannot span isolated runspaces. The ',(0,t.jsx)(s.code,{children:"Block"})," and ",(0,t.jsx)(s.code,{children:"Container"})," scopes still work and stay parallel."]}),"\n"]}),"\n",(0,t.jsx)(s.h3,{id:"code-coverage-is-not-merged-yet",children:"Code coverage is not merged yet"}),"\n",(0,t.jsxs)(s.p,{children:["Code coverage is ",(0,t.jsx)(s.strong,{children:"disabled inside the workers"})," and the parallel runner does not merge coverage across files yet. Enabling ",(0,t.jsx)(s.code,{children:"CodeCoverage"})," forces the whole run back to sequential (see above), so ",(0,t.jsx)(s.code,{children:"Run.CodeCoverage"})," is only populated on a sequential run. ",(0,t.jsx)(s.a,{href:"./test-results",children:"Test result files"})," are unaffected - the parent writes a single report from the merged tree."]}),"\n",(0,t.jsxs)(s.h3,{id:"opting-a-file-out-with-pesterno-parallel",children:["Opting a file out with ",(0,t.jsx)(s.code,{children:"#pester:no-parallel"})]}),"\n",(0,t.jsxs)(s.p,{children:["A file can opt out of parallelization with a comment directive, parsed like ",(0,t.jsx)(s.code,{children:"#requires"}),":"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-powershell",children:"#pester:no-parallel\n"})}),"\n",(0,t.jsxs)(s.p,{children:["Files marked this way run ",(0,t.jsx)(s.strong,{children:"sequentially, in the parent session, after the parallel batch"}),". They still appear in the same merged ",(0,t.jsx)(s.code,{children:"Run.Containers"}),", in discovery order, so the result object looks no different. Use this for files that depend on shared session state (declaration order, global setup, cross-file mocks)."]}),"\n",(0,t.jsx)(s.h3,{id:"each-file-is-discovered-in-isolation",children:"Each file is discovered in isolation"}),"\n",(0,t.jsxs)(s.p,{children:["Under parallel, each file is discovered and run in its own clean runspace, so it does ",(0,t.jsx)(s.strong,{children:"not"})," see state another file created at discovery time. A file that relied on another file's setup will fail - typically surfacing as a failed container (",(0,t.jsx)(s.code,{children:"Run.FailedContainers"}),") or a discovery error in the container's ",(0,t.jsx)(s.code,{children:"ErrorRecord"}),". Make each file self-contained, and use a ",(0,t.jsx)(s.code,{children:"Pester.BeforeContainer.ps1"})," in the repo root for shared bootstrap that must run before every file. See ",(0,t.jsx)(s.a,{href:"./discovery-and-run",children:"Discovery and Run"})," and the ",(0,t.jsx)(s.a,{href:"../migrations/v5-to-v6#discovery-and-run-now-happen-per-file",children:"v5 to v6 migration guide"}),"."]}),"\n",(0,t.jsx)(s.h2,{id:"stable-vs-internal-properties",children:"Stable vs. internal properties"}),"\n",(0,t.jsxs)(s.p,{children:["The objects carry more properties than the tables above - things like ",(0,t.jsx)(s.code,{children:"FrameworkData"}),", ",(0,t.jsx)(s.code,{children:"PluginData"})," and the various ",(0,t.jsx)(s.code,{children:"Own*"})," fields are used internally. Stick to the documented properties; internal ones can change between releases without notice."]}),"\n",(0,t.jsxs)(s.p,{children:["For debugging you can ask Pester to return the unfiltered object with ",(0,t.jsx)(s.code,{children:"Debug.ReturnRawResultObject = $true"}),", but as the name says, ",(0,t.jsx)(s.strong,{children:"do not build on it"})," - non-public properties may be renamed without warning."]})]})}function a(e={}){let{wrapper:s}={...(0,d.R)(),...e.components};return s?(0,t.jsx)(s,{...e,children:(0,t.jsx)(h,{...e})}):h(e)}},7008(e,s,r){r.d(s,{R:()=>i,x:()=>l});var n=r(1763);let t={},d=n.createContext(t);function i(e){let s=n.useContext(d);return n.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function l(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),n.createElement(d.Provider,{value:s},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.