For unknown reasons when I attempt to test this function my terminal calls "Send-myEmail" and waits for user input to fill in parameters. I find this odd because I have it within the Mocks section of my pester test. Its as if running the Pester test is not mocking the "Send-myEmail" command. I have tried many different variations and cannot get this to work.
FYI – "Send-myEmail" takes in all of the regular parameters "Send-Message" would but I made my own function and defaulted many of the parameters for easier use.
When you mock a command in Pester it doesn't completely nullify it. It creates a proxy command which copies all of it's parameters. I bet that your Send-MyEmail function has a mandatory parameter that's a credential.
The topic ‘function requests user input as Pester Test runs’ is closed to new replies.