en-us/about_using_psmoduledevelopment.help.txt

TOPIC
    about_using_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)

KEYWORDS
    module development debugging