SHARE
TWEET

Untitled

a guest Sep 19th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Get-Module Pester, m | Remove-Module
  2. Import-Module Pester -MaximumVersion 4.9.9
  3. New-Module -Name m -ScriptBlock {
  4.     function a { "hello" }
  5.     function b { a }
  6.  
  7.     Export-ModuleMember -Function b
  8. } | Import-Module
  9.  
  10.  
  11. Describe "m" {
  12.     It "can't see 'a'" {
  13.         { a } | Should -Throw
  14.     }
  15.  
  16.     It "but it can mock 'a'" {
  17.         Mock a -ModuleName m { "fuuuu" }
  18.  
  19.         b | Should -Be "fuuuu"
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top