PageSourceSearch

https://pester.dev/assets/js/260cc359.9267b776.js

js pester.dev collected 2026-10-03 19:37:29 UTC 9,544 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkpester_docs=self.webpackChunkpester_docs||[]).push([["3129"],{2835(e,n,s){s.r(n),s.d(n,{metadata:()=>t,default:()=>h,frontMatter:()=>a,contentTitle:()=>r,toc:()=>d,assets:()=>o});var t=JSON.parse('{"id":"commands/Should-NotBeLikeString","title":"Should-NotBeLikeString","description":"Help for Pester command \'Should-NotBeLikeString\'. Asserts that the actual value is not like the expected value.","source":"@site/docs/commands/Should-NotBeLikeString.mdx","sourceDirName":"commands","slug":"/commands/Should-NotBeLikeString","permalink":"/docs/commands/Should-NotBeLikeString","draft":false,"unlisted":false,"editUrl":null,"tags":[],"version":"current","frontMatter":{"id":"Should-NotBeLikeString","title":"Should-NotBeLikeString","description":"Help for Pester command \'Should-NotBeLikeString\'. Asserts that the actual value is not like the expected value.","keywords":["PowerShell","Pester","Help","Documentation"],"hide_title":false,"hide_table_of_contents":false,"custom_edit_url":null},"sidebar":"commands","previous":{"title":"Should-NotBeEmptyString","permalink":"/docs/commands/Should-NotBeEmptyString"},"next":{"title":"Should-NotBeNull","permalink":"/docs/commands/Should-NotBeNull"}}'),l=s(1987),i=s(7008);let a={id:"Should-NotBeLikeString",title:"Should-NotBeLikeString",description:"Help for Pester command 'Should-NotBeLikeString'. Asserts that the actual value is not like the expected value.",keywords:["PowerShell","Pester","Help","Documentation"],hide_title:!1,hide_table_of_contents:!1,custom_edit_url:null},r,o={},d=[{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:"PARAMETERS",id:"parameters",level:2},{value:"-Actual",id:"-actual",level:3},{value:"-Because",id:"-because",level:3},{value:"-CaseSensitive",id:"-casesensitive",level:3},{value:"-Expected",id:"-expected",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 c(e){let n={a:"a",admonition:"admonition",code:"code",em:"em",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.admonition,{title:"This page was generated",type:"info",children:(0,l.jsxs)(n.p,{children:["Contributions are welcome in ",(0,l.jsx)(n.a,{href:"https://github.com/pester/pester",children:"Pester-repo"}),"."]})}),"\n",(0,l.jsx)(n.h2,{id:"synopsis",children:"SYNOPSIS"}),"\n",(0,l.jsx)(n.p,{children:"Asserts that the actual value is not like the expected value."}),"\n",(0,l.jsx)(n.h2,{id:"syntax",children:"SYNTAX"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Should-NotBeLikeString [-Expected] <string> [[-Actual] <Object>] [-CaseSensitive]\n [-Because <string>]\n"})}),"\n",(0,l.jsx)(n.h2,{id:"description",children:"DESCRIPTION"}),"\n",(0,l.jsxs)(n.p,{children:["The ",(0,l.jsx)(n.code,{children:"Should-NotBeLikeString"})," assertion compares the actual value to the expected value using the ",(0,l.jsx)(n.code,{children:"-notlike"})," operator.\nThe ",(0,l.jsx)(n.code,{children:"-notlike"})," operator is case-insensitive by default, but you can make it case-sensitive by using the ",(0,l.jsx)(n.code,{children:"-CaseSensitive"})," switch."]}),"\n",(0,l.jsx)(n.h2,{id:"examples",children:"EXAMPLES"}),"\n",(0,l.jsx)(n.h3,{id:"example-1",children:"EXAMPLE 1"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:'"hello" | Should-NotBeLikeString "H*"\n'})}),"\n",(0,l.jsx)(n.p,{children:"This assertion will pass, because the actual value is not like the expected value."}),"\n",(0,l.jsx)(n.h3,{id:"example-2",children:"EXAMPLE 2"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:'"hello" | Should-NotBeLikeString "h*" -CaseSensitive\n'})}),"\n",(0,l.jsx)(n.p,{children:"This assertion will fail, because the actual value is like the expected value."}),"\n",(0,l.jsx)(n.h2,{id:"parameters",children:"PARAMETERS"}),"\n",(0,l.jsx)(n.h3,{id:"-actual",children:"-Actual"}),"\n",(0,l.jsx)(n.p,{children:"The actual value."}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-yaml",children:"Type: System.Object\nDefaultValue: ''\nSupportsWildcards: false\nAliases: []\nParameterSets:\n- N
1ame: (All)\n  Position: 1\n  IsRequired: false\n  ValueFromPipeline: true\n  ValueFromPipelineByPropertyName: false\n  ValueFromRemainingArguments: false\nDontShow: false\nAcceptedValues: []\nHelpMessage: ''\n"})}),"\n",(0,l.jsx)(n.h3,{id:"-because",children:"-Because"}),"\n",(0,l.jsx)(n.p,{children:"The reason why the actual value should not be like the expected value."}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.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,l.jsx)(n.h3,{id:"-casesensitive",children:"-CaseSensitive"}),"\n",(0,l.jsx)(n.p,{children:"Indicates that the comparison should be case-sensitive."}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-yaml",children:"Type: System.Management.Automation.SwitchParameter\nDefaultValue: False\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,l.jsx)(n.h3,{id:"-expected",children:"-Expected"}),"\n",(0,l.jsx)(n.p,{children:"The expected value."}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-yaml",children:"Type: System.String\nDefaultValue: ''\nSupportsWildcards: false\nAliases: []\nParameterSets:\n- Name: (All)\n  Position: 0\n  IsRequired: true\n  ValueFromPipeline: false\n  ValueFromPipelineByPropertyName: false\n  ValueFromRemainingArguments: false\nDontShow: false\nAcceptedValues: []\nHelpMessage: ''\n"})}),"\n",(0,l.jsx)(n.h3,{id:"commonparameters",children:"CommonParameters"}),"\n",(0,l.jsxs)(n.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,l.jsx)(n.a,{href:"https://go.microsoft.com/fwlink/?LinkID=113216",children:"about_CommonParameters"}),"."]}),"\n",(0,l.jsx)(n.h2,{id:"inputs",children:"INPUTS"}),"\n",(0,l.jsx)(n.h3,{id:"systemobject",children:"System.Object"}),"\n",(0,l.jsx)(n.h2,{id:"outputs",children:"OUTPUTS"}),"\n",(0,l.jsx)(n.h2,{id:"notes",children:"NOTES"}),"\n",(0,l.jsxs)(n.p,{children:["The ",(0,l.jsx)(n.code,{children:"Should-NotBeLikeString"})," assertion is the opposite of the ",(0,l.jsx)(n.code,{children:"Should-BeLikeString"})," assertion."]}),"\n",(0,l.jsxs)(n.p,{children:["Use the ",(0,l.jsx)(n.code,{children:"-ErrorAction"})," parameter to control soft-assertion behavior for this assertion.\n",(0,l.jsx)(n.code,{children:"-ErrorAction Continue"})," records the failure and lets the rest of the test run (a soft assertion), while ",(0,l.jsx)(n.code,{children:"-ErrorAction Stop"})," fails the test immediately, for example to guard a precondition before continuing."]}),"\n",(0,l.jsxs)(n.p,{children:["When ",(0,l.jsx)(n.code,{children:"-ErrorAction"})," is not specified, the behavior comes from ",(0,l.jsx)(n.code,{children:"Should.ErrorAction"})," in the configuration, which defaults to ",(0,l.jsx)(n.code,{children:"Stop"}),".\nSee ",(0,l.jsx)(n.a,{href:"https://pester.dev/docs/assertions/soft-assertions",children:"https://pester.dev/docs/assertions/soft-assertions"})," for more about soft assertions."]}),"\n",(0,l.jsx)(n.h2,{id:"related-links",children:"RELATED LINKS"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.a,{href:"https://pester.dev/docs/commands/Should-NotBeLikeString",children:"https://pester.dev/docs/commands/Should-NotBeLikeString"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.a,{href:"https://pester.dev/docs/assertions",children:"https://pester.dev/docs/assertions"})}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"version",children:"VERSION"}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsxs)(n.em,{children:["This page was generated using comment-based help in ",(0,l.jsx)(n.a,{href:"https://github.com/pester/
1pester",children:"Pester 6.1.0"}),"."]})})]})}function h(e={}){let{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(c,{...e})}):c(e)}},7008(e,n,s){s.d(n,{R:()=>a,x:()=>r});var t=s(1763);let l={},i=t.createContext(l);function a(e){let n=t.useContext(i);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:a(e.components),t.createElement(i.Provider,{value:n},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.