0

Is there a way to set the Pester Configuration object so that a function is mocked whenever it is called in any test files while Pester is running?

I have various functions across my scripts that call Write-Progress/Write-Host, etc...

Most of the time I do not want to see this output because it makes the Pester output hard to read, but I would like to be able to turn it on without changing across hundreds or thousands of individual files.

Efie
  • 1,430
  • 2
  • 14
  • 34

1 Answers1

0

You can add before all in all your test files to mock the functions - also you can write a single function which gets called by beforeall of all the test files

https://pester-docs.netlify.app/docs/usage/setup-and-teardown#beforeall

scorpio
  • 1,587
  • 2
  • 15
  • 27