TylerLeonhardt / vscode-pester-test-adapter

MIT License
33 stars 13 forks source link

Warn about Pester code execution #18

Closed TylerLeonhardt closed 3 years ago

TylerLeonhardt commented 3 years ago

From #16

You need to add a step (logic) to your flow that prevents auto-execution. Not all tests are great (or even non-destructive) and executing them silently is pretty bad. In the case of GPOZaurr, it basically creates/deletes some permissions in GPO but it may as well remove GPOS, create new ones. This is my test AD so not a big deal but if someone copies the code to his computer on production it could be game over. And that is just if the tests are "finished" and working correctly. The limits of PowerShell/Pester may be known but you do have control over Typescript to some degree. Maybe look for tests by default in \Tests folder and make users approve usage per project. What I am trying to say it's a really dangerous state now.

I agree. I'll say

Pester test discovery requires the code outside of Describe blocks in all *.Tests.ps1 file to be executed. Would you like to run the Pester discovery?"

"Yes/No/Always"

where the "always" option sets a configuration.