-
-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with 'AboutModules.Koans.ps1' #342
Comments
Nice catch, those all look like something we should be fixing. The first one is a bit persnickety, aye, I've been wrestling with the best way to handle that for quite a while, as it's quite context sensitive. PSKoans does its best to provide a relatively clean session state so the experience is at least consistent for all users, if not necessarily consistent with the environment a given user may be accustomed to. That change looks like a good one, we'd probably just want to change the variable name to match as well. 🙂 |
* 🔧 Resolve issues in AboutModules Fixes #342 * 🔧 Fix issues in AboutTeeObject Fixes #341 Also added a new koan to show when the variable is created * 🔧 Fix issues in AboutMeasureObject Fixes #340 * 🔧 Fix issues in AboutSelectObject Fixes #339 Fixes #337 * 🔧 Fix issue in AboutAssignmentAndArithmetic Fixes #334 * 🔧 Fix issues in AboutDiscovery Fixes #335 Fixes #332 * 🔧 ♻️ Fix up AboutArrays Fixes #330 * 🔧 Fix missing variable reference * 🎨 Update format of array declaration
ISSUE 1
Original Line 36
$TypeOf6thModule = $Modules[5].ModuleType
Modified Line 36
$TypeOf6thModule = $Modules[$Modules.Count-1].ModuleType
Let's start with, I am trying to get comfortable with VS Code.
So IMHO Get-Module is VERY system dependent, it turns out when running Show-Karma it only returns 5 Modules. Lots of trial and error to establish this, so there was never a 6th Module to get the type of.
When I run the command "Get-Module | Sort-Object -Property Name -Unique" in the PowerShell console I will get $Modules with a count of 8.
When I run the command "Get-Module | Sort-Object -Property Name -Unique" in the PowerShell Integrated console I get a count of 8.
The actual modules identified are different in each console.
If I restart VS Code and run the command "Get-Module | Sort-Object -Property Name -Unique" before I run Show-Karma, I get different results from what I got before.
So in conclusion evaluating $TypeOf6thModule can be a bit of challenge. At least with the modified line, you aren't hitting a $null record.
I am sure that on some systems this works just fine.
I'm not actually sure what can be done about this, to make it more solid and reliable, but knowing it can be an issue may help someone in the future.
ISSUE 2 -ArgumentList parameter not needed.
Original Line 120
$Module = New-Module -Name 'PSKoans_TestModule' -ScriptBlock {} -ArgumentList
Modified Line 120
$Module = New-Module -Name 'PSKoans_TestModule' -ScriptBlock {}
System throws error if an argument list is not provided. Removing the ArgumentList parameter solves the problem.
ISSUE 3 Typo, there was a space in the wrong spot.
Original Line 182
Import-Module 'TestDrive:\TestModule.psm1' | Should -Be NullOrEmpty
Modified Line 182
Import-Module 'TestDrive:\TestModule.psm1' | Should -BeNullOrEmpty
The text was updated successfully, but these errors were encountered: