You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ScubaGear is currently not only importing the root module itself into a PowerShell session but several of its internal modules. This was done to as a fix for an issue in our functional testing code.
ScubaGear should not also importing its internal modules into the active PowerShell session as their own modules. Since this can cause namespace conflicts and developer confusion when interacting with these modules.
To reproduce
Import-Module .\PowerShell\ScubaGear
Get-module # displays all imported modules.
Expected behavior
Only the ScubaGear module itself is imported when a user imports ScubaGear.
Any helpful log output or screenshots
The original black magic fix in the ScubaGear Support.psm1 module. The ScubaGear is imported here and used to find the root module path. This was to fix an issue in the functional tests.
The fix for this issue will involve removing the import like the image below and fixing the bug that appears in the functional tests when the import is removed.
The other main part of the issue involves the Support.psm1 module being imported as a NestedModule inside the manifest. Support.psm1 should be moved to the root ScubaGear.psm1 module and NestedModule commented out.
How the Support.psm1 is imported above causes the internal Dependencies, RaiseFunctionCap, and Support modules to be imported into the PowerShell terminal session. Running Get-Module after importing ScubaGear picture below.
Example of removing the NestedModule Support.psm1 import and commenting it out.
When importing ScubaGear after moving the Support.psm1 module import to ScubaGear.psm1 we can see that the extra imported functions no longer appear when running Get-Module. Note that the modules are still imported within ScubaGear itself but they no longer are "externally" imported as their own separate modules.
Summary of the fix
Fix the workaround import in Support.psm1 and the error the appears from the failing functional tests.
Remove the Support.psm1NestedModule import in the ScubaGear.psd1 manifest.
Import Support.psm1 instead in ScubaGear.psm1.
The text was updated successfully, but these errors were encountered:
buidav
added
the
bug
This issue or pull request addresses broken functionality
label
Oct 1, 2024
🐛 Summary
ScubaGear is currently not only importing the root module itself into a PowerShell session but several of its internal modules. This was done to as a fix for an issue in our functional testing code.
ScubaGear should not also importing its internal modules into the active PowerShell session as their own modules. Since this can cause namespace conflicts and developer confusion when interacting with these modules.
To reproduce
Expected behavior
Only the ScubaGear module itself is imported when a user imports ScubaGear.
Any helpful log output or screenshots
Support.psm1
module. The ScubaGear is imported here and used to find the root module path. This was to fix an issue in the functional tests.Support.psm1
module being imported as aNestedModule
inside the manifest.Support.psm1
should be moved to the rootScubaGear.psm1
module andNestedModule
commented out.Support.psm1
is imported above causes the internalDependencies
,RaiseFunctionCap
, andSupport
modules to be imported into the PowerShell terminal session. RunningGet-Module
after importing ScubaGear picture below.Support.psm1
module import toScubaGear.psm1
we can see that the extra imported functions no longer appear when runningGet-Module
. Note that the modules are still imported within ScubaGear itself but they no longer are "externally" imported as their own separate modules.Summary of the fix
Support.psm1
and the error the appears from the failing functional tests.Support.psm1
NestedModule
import in theScubaGear.psd1
manifest.Support.psm1
instead inScubaGear.psm1
.The text was updated successfully, but these errors were encountered: