Skip to content
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

Closed
ghost opened this issue Jan 7, 2020 · 1 comment · Fixed by #347
Closed

Issues with 'AboutModules.Koans.ps1' #342

ghost opened this issue Jan 7, 2020 · 1 comment · Fixed by #347
Assignees
Labels
Category-Koans Invoking the Great Doubt Issue-Bug 🐛 Something's wrong! Issue-Enhancement 🎉 Make it better!

Comments

@ghost
Copy link

ghost commented Jan 7, 2020

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

@ghost ghost added Category-Koans Invoking the Great Doubt Issue-Discussion Let's talk about it! labels Jan 7, 2020
@vexx32
Copy link
Owner

vexx32 commented Jan 7, 2020

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. 🙂

@vexx32 vexx32 added Good First Issue ❇️ Should be quick and easy! Hacktoberfest 💻 Issue-Bug 🐛 Something's wrong! Issue-Enhancement 🎉 Make it better! Up For Grabs / Hacktoberfest 💻 If it's Up For Grabs, take it and run with it! If not, ask if it's in progress / you can take it. and removed Issue-Discussion Let's talk about it! labels Jan 7, 2020
vexx32 added a commit that referenced this issue Jan 18, 2020
@vexx32 vexx32 removed Good First Issue ❇️ Should be quick and easy! Up For Grabs / Hacktoberfest 💻 If it's Up For Grabs, take it and run with it! If not, ask if it's in progress / you can take it. labels Jan 18, 2020
@vexx32 vexx32 self-assigned this Jan 18, 2020
vexx32 added a commit that referenced this issue Jan 18, 2020
vexx32 added a commit that referenced this issue Jan 19, 2020
* 🔧 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Koans Invoking the Great Doubt Issue-Bug 🐛 Something's wrong! Issue-Enhancement 🎉 Make it better!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant