PageSourceSearch

https://pester.dev/assets/js/274cb5a1.83f0450b.js

js pester.dev collected 2026-10-03 19:39:35 UTC 8,650 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkpester_docs=self.webpackChunkpester_docs||[]).push([["5669"],{8208(e,t,n){n.r(t),n.d(t,{metadata:()=>s,default:()=>h,frontMatter:()=>r,contentTitle:()=>o,toc:()=>c,assets:()=>a});var s=JSON.parse('{"id":"commands/Should-NotBeWhiteSpaceString","title":"Should-NotBeWhiteSpaceString","description":"Help for Pester command \'Should-NotBeWhiteSpaceString\'. Ensures that the input is a string, and that the input is not $null, empty, or whitespace only string.","source":"@site/docs/commands/Should-NotBeWhiteSpaceString.mdx","sourceDirName":"commands","slug":"/commands/Should-NotBeWhiteSpaceString","permalink":"/docs/commands/Should-NotBeWhiteSpaceString","draft":false,"unlisted":false,"editUrl":null,"tags":[],"version":"current","frontMatter":{"id":"Should-NotBeWhiteSpaceString","title":"Should-NotBeWhiteSpaceString","description":"Help for Pester command \'Should-NotBeWhiteSpaceString\'. Ensures that the input is a string, and that the input is not $null, empty, or whitespace only string.","keywords":["PowerShell","Pester","Help","Documentation"],"hide_title":false,"hide_table_of_contents":false,"custom_edit_url":null},"sidebar":"commands","previous":{"title":"Should-NotBeString","permalink":"/docs/commands/Should-NotBeString"},"next":{"title":"Should-NotContainCollection","permalink":"/docs/commands/Should-NotContainCollection"}}'),i=n(1987),l=n(7008);let r={id:"Should-NotBeWhiteSpaceString",title:"Should-NotBeWhiteSpaceString",description:"Help for Pester command 'Should-NotBeWhiteSpaceString'. Ensures that the input is a string, and that the input is not $null, empty, or whitespace only string.",keywords:["PowerShell","Pester","Help","Documentation"],hide_title:!1,hide_table_of_contents:!1,custom_edit_url:null},o,a={},c=[{value:"SYNOPSIS",id:"synopsis",level:2},{value:"SYNTAX",id:"syntax",level:2},{value:"DESCRIPTION",id:"description",level:2},{value:"EXAMPLES",id:"examples",level:2},{value:"EXAMPLE 1",id:"example-1",level:3},{value:"EXAMPLE 2",id:"example-2",level:3},{value:"EXAMPLE 3",id:"example-3",level:3},{value:"PARAMETERS",id:"parameters",level:2},{value:"-Actual",id:"-actual",level:3},{value:"-Because",id:"-because",level:3},{value:"CommonParameters",id:"commonparameters",level:3},{value:"INPUTS",id:"inputs",level:2},{value:"System.Object",id:"systemobject",level:3},{value:"OUTPUTS",id:"outputs",level:2},{value:"NOTES",id:"notes",level:2},{value:"RELATED LINKS",id:"related-links",level:2},{value:"VERSION",id:"version",level:2}];function d(e){let t={a:"a",admonition:"admonition",code:"code",em:"em",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",ul:"ul",...(0,l.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.admonition,{title:"This page was generated",type:"info",children:(0,i.jsxs)(t.p,{children:["Contributions are welcome in ",(0,i.jsx)(t.a,{href:"https://github.com/pester/pester",children:"Pester-repo"}),"."]})}),"\n",(0,i.jsx)(t.h2,{id:"synopsis",children:"SYNOPSIS"}),"\n",(0,i.jsx)(t.p,{children:"Ensures that the input is a string, and that the input is not $null, empty, or whitespace only string."}),"\n",(0,i.jsx)(t.h2,{id:"syntax",children:"SYNTAX"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-powershell",children:"Should-NotBeWhiteSpaceString [[-Actual] <Object>] [-Because <string>]\n"})}),"\n",(0,i.jsx)(t.h2,{id:"description",children:"DESCRIPTION"}),"\n",(0,i.jsxs)(t.p,{children:["This assertion requires a string that contains at least one non-whitespace character.\nIt fails for ",(0,i.jsx)(t.code,{children:"$null, "}),'""`, whitespace-only strings, and non-string values.']}),"\n",(0,i.jsx)(t.h2,{id:"examples",children:"EXAMPLES"}),"\n",(0,i.jsx)(t.h3,{id:"example-1",children:"EXAMPLE 1"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-powershell",children:'$actual = "hello"\n$actual | Should-NotBeWhiteSpaceString\n'})}),"\n",(0,i.jsx)(t.p,{children:"This test will pass."}),"\n",(0,i.jsx)(t.h3,{id:"example-2",children:"EXAMPLE 2"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-powershell",children:'$actual = "  "\n$actual | Should-NotBeWhiteSpaceString\n'})}),"\n",(0,i.jsx)(t.p,{children:"This test will fail, the input is a whitespace only string."}),"\n",(0,i.jsx)(t.h3,{id:"example-3",children:"EXAMPLE 3"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-powershell",children:'$null | Should-NotBeWhiteSpaceString\n"" | Should-NotBeWhiteSpaceString\n$() | Should-NotBeWhiteSpaceString\n$false | Should-NotBeWhiteSpaceString\n1 | Should-NotBeWhiteSpaceString\n'})}),"\n",(0,i.jsx)(t.p,{children:"All the tests above will fail, the input is not a string."}),"\n",(0,i.jsx)(t.h2,{id:"parameters",children:"PARAMETERS"}),"\n",(0,i.jsx)(t.h3,{id:"-actual",children:"-Actual"}),"\n",(0,i.jsx)(t.p,{children:"The actual value that will be compared."}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-yaml",children:"Type: System.Object\nDefaultValue: ''\nSupportsWildcards: false\nAliases: []\nParameterSets:\n- N
1ame: (All)\n  Position: 0\n  IsRequired: false\n  ValueFromPipeline: true\n  ValueFromPipelineByPropertyName: false\n  ValueFromRemainingArguments: false\nDontShow: false\nAcceptedValues: []\nHelpMessage: ''\n"})}),"\n",(0,i.jsx)(t.h3,{id:"-because",children:"-Because"}),"\n",(0,i.jsx)(t.p,{children:"The reason why the input should be a string that is not $null, empty, or whitespace only string."}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-yaml",children:"Type: System.String\nDefaultValue: ''\nSupportsWildcards: false\nAliases: []\nParameterSets:\n- Name: (All)\n  Position: Named\n  IsRequired: false\n  ValueFromPipeline: false\n  ValueFromPipelineByPropertyName: false\n  ValueFromRemainingArguments: false\nDontShow: false\nAcceptedValues: []\nHelpMessage: ''\n"})}),"\n",(0,i.jsx)(t.h3,{id:"commonparameters",children:"CommonParameters"}),"\n",(0,i.jsxs)(t.p,{children:["This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,\n-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,\n-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see\n",(0,i.jsx)(t.a,{href:"https://go.microsoft.com/fwlink/?LinkID=113216",children:"about_CommonParameters"}),"."]}),"\n",(0,i.jsx)(t.h2,{id:"inputs",children:"INPUTS"}),"\n",(0,i.jsx)(t.h3,{id:"systemobject",children:"System.Object"}),"\n",(0,i.jsx)(t.h2,{id:"outputs",children:"OUTPUTS"}),"\n",(0,i.jsx)(t.h2,{id:"notes",children:"NOTES"}),"\n",(0,i.jsxs)(t.p,{children:["Use the ",(0,i.jsx)(t.code,{children:"-ErrorAction"})," parameter to control soft-assertion behavior for this assertion.\n",(0,i.jsx)(t.code,{children:"-ErrorAction Continue"})," records the failure and lets the rest of the test run (a soft assertion), while ",(0,i.jsx)(t.code,{children:"-ErrorAction Stop"})," fails the test immediately, for example to guard a precondition before continuing."]}),"\n",(0,i.jsxs)(t.p,{children:["When ",(0,i.jsx)(t.code,{children:"-ErrorAction"})," is not specified, the behavior comes from ",(0,i.jsx)(t.code,{children:"Should.ErrorAction"})," in the configuration, which defaults to ",(0,i.jsx)(t.code,{children:"Stop"}),".\nSee ",(0,i.jsx)(t.a,{href:"https://pester.dev/docs/assertions/soft-assertions",children:"https://pester.dev/docs/assertions/soft-assertions"})," for more about soft assertions."]}),"\n",(0,i.jsx)(t.h2,{id:"related-links",children:"RELATED LINKS"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:(0,i.jsx)(t.a,{href:"https://pester.dev/docs/commands/Should-NotBeWhiteSpaceString",children:"https://pester.dev/docs/commands/Should-NotBeWhiteSpaceString"})}),"\n",(0,i.jsx)(t.li,{children:(0,i.jsx)(t.a,{href:"https://pester.dev/docs/assertions",children:"https://pester.dev/docs/assertions"})}),"\n"]}),"\n",(0,i.jsx)(t.h2,{id:"version",children:"VERSION"}),"\n",(0,i.jsx)(t.p,{children:(0,i.jsxs)(t.em,{children:["This page was generated using comment-based help in ",(0,i.jsx)(t.a,{href:"https://github.com/pester/pester",children:"Pester 6.1.0"}),"."]})})]})}function h(e={}){let{wrapper:t}={...(0,l.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},7008(e,t,n){n.d(t,{R:()=>r,x:()=>o});var s=n(1763);let i={},l=s.createContext(i);function r(e){let t=s.useContext(l);return s.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),s.createElement(l.Provider,{value:t},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.