en-us/about_psmoduledevelopment.help.txt
TOPIC about_psmoduledevelopment SHORT DESCRIPTION Explains how the PSModuleDevelopment module can enhance your module development LONG DESCRIPTION This module enhances module development by adding simple debugging configuration and tools to your console. To get the best mileage out of this, add its import to your profile. See this article if you wonder how to do that: http://allthingspowershell.blogspot.de/2015/01/about-profiles.html During import it will automatically import all modules that you configure it to import, allowing you to specify ... - Whether they should be imported in debug mode - Any action that should be taken before importing - Any action that should be taken after importing To configure this, use Set-ModuleDebug To check the configuration, use Get-ModuleDebug To remove configurations, use Remove-ModuleDebug You can also configure a module to NOT be automatically imported and still store debugmode, preimportaction and postimportaction for it. In that case you can use Import-ModuleDebug to import it manually at a later time. Also, to further simplify your module testing, you can use the function Restart-Shell (or its alias "rss") to swiftly restart a powershell console, reinitializing a clean environment (and auto-importing all modules configured for auto-import). | Debug Mode: It was said, that modules may be configured to launch in debug mode. However, debug mode is something that must be configured within the module to be thus imported. As a general good practice, each module should ship with its own tests. These however should not always be actually executed, thus a trigger must be configured. This module assumes that one such trigger is a variable named "<modulename>_DebugMode" and will write this variable on the global scope, if a configuration is set to debug mode. The module to be tested should then recognize this variable and run its tests. However, this can only ever be configured on the module to be tested. Example for debug mode: The module "cPSNetwork" has its own tests file. Its content looks like this: if ($cPSNetwork_DebugMOde) { #region Tests # Test 1 # Test 2 # Test 3 #endregion Tests } | Module configurations: All this configuration is stored in an xml file. By default, it is stored in this path: "$($env:APPDATA)\InfernalAssociates\PowerShell\PSModuleDevelopment\config.xml" However, this behavior can be overridden, by configuring a different path (including the file name) in this variable: $global:PSModuleDevelopment_ModuleConfigPath (Yes, on the global scope, since module management is a global matter as far as the console is concerned) VERSIONS 1.3.0.0 (October 19th, 2016): - New function: Measure-CommandEx Measures the executiontime of a scriptblock any number of time and presents the average execution time. This provides better statistics, as a single run can easily be influenced by outside factors, while an average over a thousand executions will be more reliable. - Renamed function: Get-ExHelp --> Get-HelpEx Introduces constistent naming across functions and prevents confusing the "ex" (for Extended) to be confused with a module prefix. - New Alias: Get-ExHelp --> Get-HelpEx So that users who still like the old naming can still use it - New Alias: hex --> Get-HelpEx Because getting help should be simple. 1.2.0.0 (August 15th, 2016): - New function: Get-ExHelp Provides localized help to better test modules with localized help content. KEYWORDS module development debugging |