EliziumNet/Loopz

Refactor tests that use internal functions

Closed this issue · 2 comments

Because of a misunderstanding of Pester's InModuleScope, some tests have been implemented poorly with bad work-arounds. These bad work arounds including manually sourcing files hosting internal commands and defining test functions inside module scope.

These tests shoould be refactored to make correct use of InModuleScope; see 'invoke-PostProcessing' for an example of the correct way to do this.

Useful resource that describes scopes in PowerShell: Understanding PowerShell Variable Scopes

The key to getting this to work properly is prefixing any test functions with 'script:' scope specifier and ensuring that all code in running InModuleScope.