PageSourceSearch

https://pester-docs.netlify.app/assets/js/c4f5d8e4.c7100f8d.js

js pester-docs.netlify.app collected 2026-10-03 11:18:06 UTC 15,448 bytes, 10 lines download raw bytes

1"use strict";(self.webpackChunkpester_docs=self.webpackChunkpester_docs||[]).push([["4823"],{7738(e,s,t){t.r(s),t.d(s,{default:()=>B});var a=t(1987),i=t(1763),o=t(3526),r=t(1359),n=t(6415),l=t(4137),c=t(7687),d=t(3316),h=t(9609);let p={section:"section_rC2D",sectionAlt:"sectionAlt_XiGz",sectionInner:"sectionInner_Y4r1",sectionHead:"sectionHead_ArI0",sectionTitle:"sectionTitle_czhA",sectionLead:"sectionLead_c8wK",hero:"hero_syme",heroInner:"heroInner_VWeJ",heroBadges:"heroBadges_LdwS",badge:"badge_oX1U",heroTitle:"heroTitle_ohkl",heroTitleAccent:"heroTitleAccent_d7Sc",heroSubtitle:"heroSubtitle_GKHc",heroButtons:"heroButtons_gdhS",primaryButton:"primaryButton_wDDj",githubButton:"githubButton_Bgng",secondaryButton:"secondaryButton_ZLk9",buttonArrow:"buttonArrow_hyAN",installBox:"installBox_fIqj",installPrompt:"installPrompt_M6aW",installText:"installText_C4oc",installCopy:"installCopy_iv_B",platforms:"platforms_RjDm",heroShot:"heroShot_IPZe",codeGrid:"codeGrid_THOg",codeCol:"codeCol_aZog",shotFrame:"shotFrame_OV18",shotCaption:"shotCaption_GnQW",pathGrid:"pathGrid_Or2B",pathCard:"pathCard_fFQW",pathCardFeatured:"pathCardFeatured_VkQh",pathMeta:"pathMeta_Dhmc",pathTitle:"pathTitle_ipve",pathDesc:"pathDesc_Yfkq",pathPoints:"pathPoints_hWj5",pathAction:"pathAction_f6gj",pathActionOutline:"pathActionOutline_YruY",featureGrid:"featureGrid_g0sL",featureCard:"featureCard_PiI4",featureIcon:"featureIcon_WheO",featureTitle:"featureTitle_bNEx",featureDesc:"featureDesc_JIJu",credibility:"credibility_eaY5",statRow:"statRow_LZfs",stat:"stat_ezPZ",credibilityNote:"credibilityNote_pwZq",logoWall:"logoWall_O9us",logoImg:"logoImg_BsLk",logoAdaptive:"logoAdaptive_D103",placeholderHint:"placeholderHint_QEA0",sponsors:"sponsors_rN4j",sponsorHeading:"sponsorHeading_CBCi",sponsorLogos:"sponsorLogos_QzwL",ocSponsors:"ocSponsors_ns7h",cta:"cta_P7AW",ctaTitle:"ctaTitle_f8lh",ctaLead:"ctaLead_x6QV"},u="Install-Module Pester",m="/tutorial/introduction/welcome",x={width:26,height:26,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"},j=[{title:"Readable, expressive syntax",icon:(0,a.jsx)(()=>(0,a.jsxs)("svg",{...x,children:[(0,a.jsx)("polyline",{points:"8 7 3 12 8 17"}),(0,a.jsx)("polyline",{points:"16 7 21 12 16 17"}),(0,a.jsx)("line",{x1:"13.5",y1:"5",x2:"10.5",y2:"19"})]}),{}),description:"Describe, Context, It and Should read like plain English. Tests document intent instead of hiding it in boilerplate."},{title:"Powerful mocking",icon:(0,a.jsx)(()=>(0,a.jsxs)("svg",{...x,children:[(0,a.jsx)("path",{d:"M3 12a4 4 0 0 1 4-4h3v8H7a4 4 0 0 1-4-4Z"}),(0,a.jsx)("path",{d:"M21 12a4 4 0 0 1-4 4h-3V8h3a4 4 0 0 1 4 4Z"}),(0,a.jsx)("path",{d:"M10 9l4 6"})]}),{}),description:"Replace any command with a mock, control what it returns, and assert exactly how it was called \u2014 no dependency injection required."},{title:"Built-in code coverage",icon:(0,a.jsx)(()=>(0,a.jsxs)("svg",{...x,children:[(0,a.jsx)("path",{d:"M12 3l7 3v5c0 4.4-3 8.3-7 9-4-0.7-7-4.6-7-9V6l7-3Z"}),(0,a.jsx)("polyline",{points:"9 12 11.5 14.5 16 9.5"})]}),{}),description:"See which lines your tests exercise and export JaCoCo or Cobertura reports your pipeline already understands."},{title:"Runs everywhere",icon:(0,a.jsx)(()=>(0,a.jsxs)("svg",{...x,children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,a.jsx)("path",{d:"M3 12h18"}),(0,a.jsx)("path",{d:"M12 3c2.7 3 2.7 15 0 18M12 3c-2.7 3-2.7 15 0 18"})]}),{}),description:"PowerShell 7.4+ on Windows, Linux and macOS \u2014 test the same code everywhere it runs."},{title:"First-class VS Code",icon:(0,a.jsx)(()=>(0,a.jsxs)("svg",{...x,children:[(0,a.jsx)("rect",{x:"3",y:"4",width:"18",height:"13",rx:"2"}),(0,a.jsx)("path",{d:"M8 20h8M12 17v3"}),(0,a.jsx)("polyline",{points:"8.5 9 6.5 11 8.5 13"}),(0,a.jsx)("line",{x1:"12",y1:"8.5",x2:"10.5",y2:"13.5"})]}),{}),description:"Run and debug tests straight from the Test Explorer, jump to failures, and scaffold tests with snippets."},{title:"CI/CD ready",icon:(0,a.jsx)(()=>(0,a.jsxs)("svg",{...x,children:[(0,a.jsx)("path",{d:"M4 12a8 8 0 0 1 13.6-5.7L20 8"}),(0,a.jsx)("polyline",{points:"20 3 20 8 15 8"}),(0,a.jsx)("path",{d:"M20 12a8 8 0 0 1-13.6 5.7L4 16"}),(0,a.jsx)("polyline",{points:"4 21 4 16 9 16"})]}),{}),description:"Emit NUnit or JUnit results for GitHub Actions, Azure Pipelines, Jenkins and more. Fail the build when a test fails."}],g=`BeforeAll {
2    . $PSScriptRoot/Get-Planet.ps1
3}
4
5Describe 'Get-Planet' {
6    It 'lists all 8 planets' {
7        $planets = Get-Planet
8        $planets.Count | Should-Be 8
9    }
10}`;function f(){let[e,s]=(0,i.useState)(!1);return(0,a.jsxs)("button",{type:"button",className:p.installBox,onClick:()=>{try{navigator.clipboard.writeText(u),s(!0),setTimeout(()=>s(!1),1600)}catch(e){}}
10,"aria-label":"Copy install command",children:[(0,a.jsx)("span",{className:p.installPrompt,children:"PS>"}),(0,a.jsx)("code",{className:p.installText,children:u}),(0,a.jsx)("span",{className:p.installCopy,children:e?"Copied!":"Copy"})]})}function v(){return(0,a.jsxs)(n.A,{className:(0,o.A)("button button--lg",p.secondaryButton),to:m,children:["Tutorial",(0,a.jsx)("span",{className:p.buttonArrow,"aria-hidden":"true",children:"\u2192"})]})}function N(){return(0,a.jsxs)(n.A,{className:(0,o.A)("button button--lg",p.githubButton),to:"https://github.com/pester/pester",children:[(0,a.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M8 0C3.58 0 0 3.58 0 8a8 8 0 0 0 5.47 7.59c.4.07.55-.17.55-.38l-.01-1.49c-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.4 7.4 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48l-.01 2.2c0 .21.15.46.55.38A8 8 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})}),"Star on GitHub"]})}function w(e){return(0,h.QB)(e,"default")?.path}function b(){let e=(0,d.Ay)("img/home/hero-terminal.png");return(0,a.jsx)("header",{className:p.hero,children:(0,a.jsxs)("div",{className:(0,o.A)("container",p.heroInner),children:[(0,a.jsxs)("div",{className:p.heroBadges,children:[(0,a.jsx)("span",{className:p.badge,children:"Open source"}),(0,a.jsx)("span",{className:p.badge,children:"Cross-platform"}),(0,a.jsx)("span",{className:p.badge,children:"PowerShell 5.1 & 7.4+"})]}),(0,a.jsxs)("h1",{className:p.heroTitle,children:["Test your PowerShell.",(0,a.jsx)("br",{}),(0,a.jsx)("span",{className:p.heroTitleAccent,children:"Ship with confidence."})]}),(0,a.jsx)("p",{className:p.heroSubtitle,children:"Pester is the ubiquitous test and mock framework for PowerShell \u2014 expressive syntax, powerful mocking and beautiful output, everywhere PowerShell runs."}),(0,a.jsxs)("div",{className:p.heroButtons,children:[(0,a.jsx)(n.A,{className:(0,o.A)("button button--lg",p.primaryButton),to:w("quick-start"),children:"Quick Start"}),(0,a.jsx)(v,{}),(0,a.jsx)(N,{})]}),(0,a.jsx)(f,{}),(0,a.jsxs)("div",{className:p.platforms,children:[(0,a.jsx)("span",{children:"Windows"}),(0,a.jsx)("span",{children:"Linux"}),(0,a.jsx)("span",{children:"macOS"}),(0,a.jsx)("span",{children:"Azure Pipelines"}),(0,a.jsx)("span",{children:"GitHub Actions"})]}),(0,a.jsx)("div",{className:p.heroShot,children:(0,a.jsx)("img",{src:e,alt:"Example of Pester test output showing passing and failing tests",loading:"lazy"})})]})})}let y=[{title:"Quick Start",meta:"About 5 minutes",description:"The short version. Install Pester, write one test file, run it, and see what a failure looks like.",points:["Install and import Pester","Write and run your first test","Read the failure output"],action:"Read the Quick Start"},{title:"Follow-along tutorial",meta:"Seven parts, at your own pace",description:"Start with an empty folder and build a real PowerShell module, writing tests for each part as you add it.",points:["Test public functions and private helpers","Mock a data source and isolate file operations","Measure code coverage and run it all in CI"],action:"Start the tutorial",featured:!0}];function A(){let e=[w("quick-start"),m];return(0,a.jsx)("section",{className:p.section,children:(0,a.jsxs)("div",{className:(0,o.A)("container",p.sectionInner),children:[(0,a.jsxs)("div",{className:p.sectionHead,children:[(0,a.jsx)("h2",{className:p.sectionTitle,children:"Two ways to start"}),(0,a.jsx)("p",{className:p.sectionLead,children:"Read the short version, or build a module from scratch and test it as you go."})]}),(0,a.jsx)("div",{className:p.pathGrid,children:y.map((s,t)=>(0,a.jsxs)("div",{className:(0,o.A)(p.pathCard,s.featured&&p.pathCardFeatured),children:[(0,a.jsx)("span",{className:p.pathMeta,children:s.meta}),(0,a.jsx)("h3",{className:p.pathTitle,children:s.title}),(0,a.jsx)("p",{className:p.pathDesc,children:s.description}),(0,a.jsx)("ul",{className:p.pathPoints,children:s.points.map(e=>(0,a.jsx)("li",{children:e},e))}),(0,a.jsx)(n.A,{className:(0,o.A)("button",s.featured?"button--primary":p.pathActionOutline,p.pathAction),to:e[t],children:s.action})]},s.title))})]})})}function _(){let e=(0,d.Ay)("img/home/output-run.png");return(0,a.jsx)("section",{className:p.section,children:(0,a.jsxs)("div",{className:(0,o.A)("container",p.sectionInner),children:[(0,a.jsxs)("div",{className:p.sectionHead,children:[(0,a.jsx)("h2",{className:p.sectionTitle,children:"Write your first test in seconds"}),(0,a.jsxs)("p",{className:p.sectionLead,children:["Save a ",(0,a.jsx)("code",{children:"*.Tests.ps1"}
10)," file, describe what your code should do, and run it. Pester handles discovery, execution and reporting."]})]}),(0,a.jsxs)("div",{className:p.codeGrid,children:[(0,a.jsx)("div",{className:p.codeCol,children:(0,a.jsx)(l.A,{language:"powershell",title:"Get-Planet.Tests.ps1",children:g})}),(0,a.jsxs)("div",{className:p.codeCol,children:[(0,a.jsx)("div",{className:p.shotFrame,children:(0,a.jsx)("img",{src:e,alt:"Pester console output with a passing test",loading:"lazy"})}),(0,a.jsx)("p",{className:p.shotCaption,children:"Green when it passes \u2014 and a precise, readable diff the moment it doesn't."})]})]})]})})}function k(){return(0,a.jsx)("section",{className:(0,o.A)(p.section,p.sectionAlt),children:(0,a.jsxs)("div",{className:(0,o.A)("container",p.sectionInner),children:[(0,a.jsxs)("div",{className:p.sectionHead,children:[(0,a.jsx)("h2",{className:p.sectionTitle,children:"Everything you need to test PowerShell"}),(0,a.jsx)("p",{className:p.sectionLead,children:"From a one-line assertion to validating entire environments \u2014 Pester scales with you."})]}),(0,a.jsx)("div",{className:p.featureGrid,children:j.map((e,s)=>(0,a.jsxs)("div",{className:p.featureCard,children:[(0,a.jsx)("div",{className:p.featureIcon,children:e.icon}),(0,a.jsx)("h3",{className:p.featureTitle,children:e.title}),(0,a.jsx)("p",{className:p.featureDesc,children:e.description})]},s))})]})})}let P=[{name:"PowerShell",src:"img/home/logos/powershell.png"},{name:"GitHub",src:"img/home/logos/github.svg",adaptive:!0},{name:"Microsoft",src:"img/home/logos/microsoft.svg"},{name:"Azure",src:"img/home/logos/azure.svg"}];function S({name:e,src:s,adaptive:t}){return(0,a.jsx)("img",{className:(0,o.A)(p.logoImg,t&&p.logoAdaptive),src:(0,d.Ay)(s),alt:`${e} logo`})}function C(){return(0,a.jsx)("section",{className:(0,o.A)(p.section,p.credibility),children:(0,a.jsxs)("div",{className:(0,o.A)("container",p.sectionInner),children:[(0,a.jsxs)("div",{className:p.statRow,children:[(0,a.jsx)("div",{className:p.stat,children:(0,a.jsx)("img",{alt:"GitHub stars",src:"https://img.shields.io/github/stars/pester/pester?style=flat-square&label=GitHub%20stars&color=0072c5"})}),(0,a.jsx)("div",{className:p.stat,children:(0,a.jsx)("img",{alt:"PowerShell Gallery downloads",src:"https://img.shields.io/powershellgallery/dt/Pester?style=flat-square&label=Gallery%20downloads&color=0072c5"})}),(0,a.jsx)("div",{className:p.stat,children:(0,a.jsx)("img",{alt:"Latest Pester version",src:"https://img.shields.io/powershellgallery/v/Pester?style=flat-square&label=latest&color=0072c5"})})]}),(0,a.jsx)("p",{className:p.credibilityNote,children:"Pester is the standard test framework for PowerShell \u2014 trusted by the PowerShell project itself and teams across the ecosystem, including Microsoft and Azure."}),(0,a.jsx)("div",{className:p.logoWall,children:P.map(e=>(0,a.jsx)(S,{...e},e.name))}),(0,a.jsx)("p",{className:p.placeholderHint,children:"Logos are trademarks of their respective owners."})]})})}function T(){return(0,a.jsx)("section",{className:(0,o.A)(p.section,p.sectionAlt),children:(0,a.jsxs)("div",{className:(0,o.A)("container",p.sectionInner,p.sponsors),children:[(0,a.jsx)("h2",{className:p.sectionTitle,children:"Meet our sponsors"}),(0,a.jsx)("p",{className:p.sectionLead,children:"Pester is sustained by the great folks on OpenCollective and GitHub Sponsors. Become a financial contributor and help us keep it thriving."}),(0,a.jsx)("h3",{className:p.sponsorHeading,children:"Individual backers"}),(0,a.jsx)("a",{href:"https://opencollective.com/pester#backers",target:"_blank",rel:"noreferrer",children:(0,a.jsx)("img",{src:"https://opencollective.com/pester/backers.svg?avatarHeight=72&width=695",alt:"Individual backers"})}),(0,a.jsx)("h3",{className:p.sponsorHeading,children:"Organizations"}),(0,a.jsxs)("div",{className:p.sponsorLogos,children:[(0,a.jsx)("a",{href:"https://www.testmu.ai/",target:"_blank",rel:"noreferrer",children:(0,a.jsx)("img",{src:(0,d.Ay)("img/sponsors/testmu-logo.png"),className:"sponsor-logo",alt:"TestMu AI"})}),(0,a.jsx)("a",{href:"https://www.dotcom-monitor.com/",target:"_blank",rel:"noreferrer",children:(0,a.jsx)("img",{src:(0,d.Ay)("img/sponsors/dotcom-monitor-logo.png"),className:"sponsor-logo",alt:"Dotcom-Monitor"})}),(0,a.jsx)("a",{href:"https://www.loadview-testing.com/",target:"_blank",rel:"noreferrer",children:(0,a.jsx)("img",{src:(0,d.Ay)("img/sponsors/loadview-logo.png"),className:"sponsor-logo",alt:"LoadView"})})]}),(0,a.jsx)("div",{className:p.ocSponsors,children:(0,a.jsx)("a",{href:"https://opencollective.com/pester#sponsors",target:"_blank",rel:"noreferrer",children:(0,a.jsx)("img",{src:"https://opencollective.com/pester/sponsors.svg?avatarHeight=72",alt:"Organization sponsors on OpenCollective"})})})]})})}function I(){return(0,a.jsx)("section",{className:p.cta,children:(0,a.jsxs)("div",{className:(0,o.A)("container",p.ctaInner),children:[(0,a.jsx)("h2",{className:p.ctaTitle,children:"Ready to write your first test?"}),(0,a.jsx)("p",{className:p.ctaLead,children:"Install Pester and go from zero to a green test in minutes."}),(0,a.jsxs)("div",{className:p.heroButtons,children:[(0,a.jsx)(n.A,{className:(0,o.A)("button button--lg",p.primaryButton),to:w("quick-start"),children:"Qu
10ick Start"}),(0,a.jsx)(v,{}),(0,a.jsx)(n.A,{className:(0,o.A)("button button--lg",p.secondaryButton),to:w("introduction/installation"),children:"Installation guide"})]})]})})}function B(){let{siteConfig:e={}}=(0,c.A)();return(0,a.jsxs)(r.A,{title:`${e.title} - The test and mock framework for PowerShell`,description:"Pester is the ubiquitous test and mock framework for PowerShell.",children:[(0,a.jsx)(b,{}),(0,a.jsxs)("main",{children:[(0,a.jsx)(A,{}),(0,a.jsx)(_,{}),(0,a.jsx)(k,{}),(0,a.jsx)(C,{}),(0,a.jsx)(T,{}),(0,a.jsx)(I,{})]})]})}}}]);

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.