Skip to content

Commit 887ccee

Browse files
alexandearnohwnd
andauthored
Correct typos in comments (#2294)
Co-authored-by: Jakub Jareš <[email protected]>
1 parent cc660e1 commit 887ccee

18 files changed

+79
-78
lines changed

docs/Examples/Planets/Get-Planet.Tests.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
# You can run this test file by pressing F5, if your editor
7-
# suports running powershell.
7+
# supports running powershell.
88

99
# You should see this output:
1010
# Describing Get-Planet
@@ -18,7 +18,7 @@
1818
# [+] Given invalid parameter -Name 'Alpha Centauri', it returns $null 22ms
1919

2020

21-
# Put the initialization code in a seperate `BeforeAll` block,
21+
# Put the initialization code in a separate `BeforeAll` block,
2222
# where you can perform i.e. your imports.
2323
BeforeAll {
2424
# First we need to import the Get-Planet.ps1 file to make the function
@@ -27,10 +27,10 @@ BeforeAll {
2727
. $PSScriptRoot/Get-Planet.ps1
2828

2929
# Normally we can use a more platform agnostic and generic approach where we import
30-
# the current path, but replace the ".Tests.ps1" occurences with ".ps1".
30+
# the current path, but replace the ".Tests.ps1" occurrences with ".ps1".
3131
# . $PSCommandPath.Replace('.Tests.ps1', '.ps1')
3232
#
33-
# We could even replace all the ".Tests" occurences in the current path
33+
# We could even replace all the ".Tests" occurrences in the current path
3434
# with "" and end up with the right filename.
3535
# . $PSCommandPath.Replace('.Tests', '')
3636
}
@@ -124,7 +124,7 @@ Describe 'Get-Planet' {
124124

125125
# Want to try it out yourself?
126126

127-
## Excercise 1:
127+
## Exercise 1:
128128
# Add filter Population that returns planets with population larger
129129
# or equal to the given number (in billions).
130130
# Use 7.5 as the population of Earth. Use 0 for all other planets.
@@ -136,15 +136,15 @@ Describe 'Get-Planet' {
136136

137137

138138

139-
# Excercise 2: Test that planets are returned in the correct order,
139+
# Exercise 2: Test that planets are returned in the correct order,
140140
# from the one closest to the Sun.
141141
# Make sure to cover these test cases:
142142
# - Order of planets is correct when no filters are used.
143143
# - Order of planets is correct when -Name filter is used.
144144

145145

146146

147-
# Excercise 3 (advanced): Add function that will list moons orbiting a given planet.
147+
# Exercise 3 (advanced): Add function that will list moons orbiting a given planet.
148148
# - Make sure you can list all moons.
149149
# - Make sure you can filter moons for given planet.
150150
# - Make sure you Get-Planet and Get-Moon functions work together.

src/Module.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Set-SessionStateHint -Hint Pester -SessionState $ExecutionContext.SessionState
2-
# these functions will be shared with the mock bootstrap function, or used in mocked calls so let's capture them just once instead of everytime we use a mock
2+
# these functions will be shared with the mock bootstrap function, or used in mocked calls so let's capture them just once instead of every time we use a mock
33
$script:SafeCommands['ExecutionContext'] = $ExecutionContext
44
$script:SafeCommands['Get-MockDynamicParameter'] = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Get-MockDynamicParameter', 'function')
55
$script:SafeCommands['Write-PesterDebugMessage'] = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Write-PesterDebugMessage', 'function')

src/Pester.Runtime.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,7 @@ function Invoke-ScriptBlock {
15891589
# here we are moving into the user scope if the provided
15901590
# scriptblock was bound to user scope, so we want to take some actions
15911591
# typically switching between user and framework timer. There are still tiny pieces of
1592-
# framework code running in the scriptblock but we can safely ignore those becasue they are
1592+
# framework code running in the scriptblock but we can safely ignore those because they are
15931593
# just logging, so the time difference is miniscule.
15941594
# The code might also run just in framework scope, in that case the callback can remain empty,
15951595
# eg when we are invoking framework setup.
@@ -1919,7 +1919,7 @@ function Invoke-Test {
19191919
$state.PluginData = $PluginData
19201920
$state.Configuration = $Configuration
19211921

1922-
# # TODO: this it potentially unreliable, because supressed errors are written to Error as well. And the errors are captured only from the caller state. So let's use it only as a useful indicator during migration and see how it works in production code.
1922+
# # TODO: this it potentially unreliable, because suppressed errors are written to Error as well. And the errors are captured only from the caller state. So let's use it only as a useful indicator during migration and see how it works in production code.
19231923

19241924
# # finding if there were any non-terminating errors during the run, user can clear the array, and the array has fixed size so we can't just try to detect if there is any difference by counts before and after. So I capture the last known error in that state and try to find it in the array after the run
19251925
# $originalErrors = $SessionState.PSVariable.Get("Error").Value
@@ -2060,7 +2060,7 @@ function PostProcess-DiscoveredBlock {
20602060
$t.ShouldRun = $false
20612061
}
20622062
else {
2063-
# run the exlude filters before checking if the parent is included
2063+
# run the exclude filters before checking if the parent is included
20642064
# otherwise you would include tests that could match the exclude rule
20652065
$shouldRun = (Test-ShouldRun -Item $t -Filter $Filter)
20662066
$t.Explicit = $shouldRun.Explicit
@@ -2214,7 +2214,7 @@ function PostProcess-ExecutedBlock {
22142214
$aggregatedChildDuration = [TimeSpan]::Zero
22152215
if (none $childBlocks) {
22162216
# one thing to consider here is what happens when a block fails, in the current
2217-
# excecution model the block can fail when a setup or teardown fails, with failed
2217+
# execution model the block can fail when a setup or teardown fails, with failed
22182218
# setup it is easy all the tests in the block are considered failed, with teardown
22192219
# not so much, when all tests pass and the teardown itself fails what should be the result?
22202220

@@ -2236,7 +2236,7 @@ function PostProcess-ExecutedBlock {
22362236
}
22372237
else {
22382238
# when we have children we first let them process themselves and
2239-
# then we add the results together (the recusion could reach to the parent and add the totals)
2239+
# then we add the results together (the recursion could reach to the parent and add the totals)
22402240
# but that is difficult with the duration, so this way is less error prone
22412241
PostProcess-ExecutedBlock -Block $childBlocks
22422242

src/csharp/Pester/Tracing/Tracer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public static void Patch(int powerShellVersion, EngineIntrinsics context, PSHost
159159
// action we just use them to get the live data without the overhead of looking
160160
// up properties all the time. This might be internally done in the reflection code
161161
// did not measure the impact, and it is probably done for us in the reflection api itself
162-
// in modern verisons of runtime
162+
// in modern versions of runtime
163163
var callStack1 = callStackField.GetValue(debugger);
164164
var callStackList1 = (NonGeneric.IList)callStack1;
165165
var level1 = callStackList1.Count - initialLevel;

src/functions/Coverage.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ function Get-CodeCoverageFilePaths {
246246
Get-CodeCoverageFilePaths -Paths $children -IncludeTests $IncludeTests -RecursePaths $RecursePaths
247247
}
248248
elseif (-not $item.PsIsContainer) {
249-
# todo: enable this warning for non wildcarded paths? otherwise it prints a ton of warnings for documenatation and so on when using "folder/*" wildcard
249+
# todo: enable this warning for non wildcarded paths? otherwise it prints a ton of warnings for documentation and so on when using "folder/*" wildcard
250250
# & $SafeCommands['Write-Warning'] "CodeCoverage path '$path' resolved to a non-PowerShell file '$($item.FullName)'; this path will not be part of the coverage report."
251251
}
252252
}
@@ -674,7 +674,7 @@ function Get-CoverageReport {
674674
if ($null -ne $Measure) {
675675

676676
# re-key the measures to use columns that are corrected for BP placement
677-
# also 1 column in tracer can map to multiple columns for BP, when there are assignements, so expand them
677+
# also 1 column in tracer can map to multiple columns for BP, when there are assignments, so expand them
678678
$bpm = @{}
679679
foreach ($path in $Measure.Keys) {
680680
$lines = @{}

src/functions/Describe.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ function Invoke-Interactively ($CommandUsed, $ScriptName, $SessionState, $BoundP
156156

157157
# there is a number of problems with this that I don't know how to solve right now
158158
# - the scripblock below will be discovered which shows a weird message in the console (maybe just suppress?)
159-
# every block will get it's own summary if we ar running multiple of them (can we somehow get to the actuall executed code?) or know which one is the last one?
159+
# every block will get it's own summary if we ar running multiple of them (can we somehow get to the actual executed code?) or know which one is the last one?
160160

161-
# use an intermediate module to carry the bound paremeters
161+
# use an intermediate module to carry the bound parameters
162162
# but don't touch the session state the scriptblock is attached
163163
# to, this way we are still running the provided scriptblocks where
164164
# they are coming from (in the SessionState they are attached to),

src/functions/Mock.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function Create-MockHook ($contextInfo, $InvokeMockCallback) {
155155
156156
# MockCallState initialization is injected only into the begin block by the code that generates this prototype
157157
# also it is not a good idea to share it via the function local data because then it will get overwritten by nested
158-
# mock if there is any, instead it should be a varible that gets defined in begin and so it survives during the whole
158+
# mock if there is any, instead it should be a variable that gets defined in begin and so it survives during the whole
159159
# pipeline, but does not overwrite other variables, because we are running in different scopes. Mindblowing.
160160
& `$MyInvocation.MyCommand.Mock.Invoke_Mock -CommandName '#FUNCTIONNAME#' -ModuleName '#MODULENAME#' ```
161161
-BoundParameters `$PSBoundParameters ```
@@ -237,12 +237,12 @@ function Create-MockHook ($contextInfo, $InvokeMockCallback) {
237237
$defineFunctionAndAliases = {
238238
param($___Mock___parameters)
239239
# Make sure the you don't use _______parameters variable here, otherwise you overwrite
240-
# the variable that is defined in the same scope and the subsequent invocation of scrips will
240+
# the variable that is defined in the same scope and the subsequent invocation of scripts will
241241
# be seriously broken (e.g. you will start resolving setups). But such is life of running in once scope.
242242
# from upper scope for no reason. But the reason is that you deleted ______param in this scope,
243243
# and so ______param from the parent scope was inherited
244244

245-
## THIS RUNS IN USER SCOPE, BE CAREFUL WHAT YOU PUBLISH AND COSUME
245+
## THIS RUNS IN USER SCOPE, BE CAREFUL WHAT YOU PUBLISH AND CONSUME
246246

247247

248248
# it is possible to remove the script: (and -Scope Script) from here and from the alias, which makes the Mock scope just like a function.
@@ -513,7 +513,7 @@ function Remove-MockHook {
513513
}
514514
}
515515
else {
516-
# # this runs from OnContainerRunEnd in the mock plugin, it might be running unnecessarilly
516+
# # this runs from OnContainerRunEnd in the mock plugin, it might be running unnecessarily
517517
# if ($Write_Debug_Enabled) {
518518
# & $Write_Debug -Scope Mock -Message "ERROR: Function $($CommandName) was not found$(if ($ExecutionContext.SessionState.Module) { " in module $($ExecutionContext.SessionState.Module) session state"} else { " in script session state"})."
519519
# }
@@ -527,7 +527,7 @@ function Remove-MockHook {
527527
}
528528
}
529529
else {
530-
# # this runs from OnContainerRunEnd in the mock plugin, it might be running unnecessarilly
530+
# # this runs from OnContainerRunEnd in the mock plugin, it might be running unnecessarily
531531
# if ($Write_Debug_Enabled) {
532532
# & $Write_Debug -Scope Mock -Message "ERROR: Alias $($alias) was not found$(if ($ExecutionContext.SessionState.Module) { " in module $($ExecutionContext.SessionState.Module) session state"} else { " in script session state"})."
533533
# }
@@ -646,7 +646,7 @@ function Resolve-Command {
646646
else {
647647
# we used to fallback to the script scope when command was not found in the module, we no longer do that
648648
# now we just search the script scope when module name is not specified. This was probably needed because of
649-
# some incosistencies of resolving the mocks. But it never made sense to me.
649+
# some inconsistencies of resolving the mocks. But it never made sense to me.
650650

651651
if ($PesterPreference.Debug.WriteDebugMessages.Value) {
652652
Write-PesterDebugMessage -Scope Mock "Searching for command $CommandName in the script scope."
@@ -689,7 +689,7 @@ function Resolve-Command {
689689
# true if we inserted the mock into a module
690690
IsFromModule = $null -ne $module
691691
TargetModule = $ModuleName
692-
# true if the commmand comes from the target module
692+
# true if the command comes from the target module
693693
IsFromTargetModule = $null -ne $module -and $ModuleName -eq $command.Mock.Hook.OriginalCommand.Module.Name
694694
IsMockBootstrapFunction = $true
695695
Hook = $command.Mock.Hook
@@ -1573,7 +1573,7 @@ function Test-IsClosure {
15731573
}
15741574

15751575
function Remove-MockFunctionsAndAliases ($SessionState) {
1576-
# when a test is terminated (e.g. by stopping at a breakpoint and then stoping the execution of the script)
1576+
# when a test is terminated (e.g. by stopping at a breakpoint and then stopping the execution of the script)
15771577
# the aliases and bootstrap functions for the currently mocked functions will remain in place
15781578
# Then on subsequent runs the bootstrap function will be picked up instead of the real command,
15791579
# because there is still an alias associated with it, and the test will fail.
@@ -1616,7 +1616,7 @@ function Remove-MockFunctionsAndAliases ($SessionState) {
16161616
continue
16171617
}
16181618

1619-
# some script modules aparently can have no session state
1619+
# some script modules apparently can have no session state
16201620
# https://github.com/PowerShell/PowerShell/blob/658837323599ab1c7a81fe66fcd43f7420e4402b/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs#L51-L55
16211621
# https://github.com/pester/Pester/issues/1921
16221622
if ('Script', 'Manifest' -contains $module.ModuleType -and $null -ne $module.SessionState) {
@@ -1651,7 +1651,7 @@ function Repair-ConflictingParameters {
16511651
continue
16521652
}
16531653

1654-
# rewrite the metadata to avoid defining confliting parameters
1654+
# rewrite the metadata to avoid defining conflicting parameters
16551655
# in the function such as $PSEdition
16561656
if ($conflictingParams -contains $paramMetadata.Name) {
16571657
$paramName = $paramMetadata.Name

src/functions/Output.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ function Get-WriteScreenPlugin ($Verbosity) {
733733
if ($PesterPreference.Output.Verbosity.Value -in 'Detailed', 'Diagnostic') {
734734
$p.EachTestSetupStart = {
735735
param ($Context)
736-
# we posponed writing the Describe / Context to grab the Expanded name, because that is done
736+
# we postponed writing the Describe / Context to grab the Expanded name, because that is done
737737
# during execution to get all the variables in scope, if we are the first test then write it
738738
if ($Context.Test.First) {
739739
Write-BlockToScreen $Context.Test.Block

src/functions/Pester.Debugging.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function Set-SessionStateHint {
125125
}
126126

127127
# in all places where we capture SessionState we mark its internal state with a hint
128-
# the internal state does not change and we use it to invoke scriptblock in diferent
128+
# the internal state does not change and we use it to invoke scriptblock in different
129129
# states, setting the hint on SessionState is only secondary to make is easier to debug
130130
$flags = [System.Reflection.BindingFlags]'Instance,NonPublic'
131131
$internalSessionState = $SessionState.GetType().GetProperty('Internal', $flags).GetValue($SessionState, $null)

src/functions/Pester.SessionState.Mock.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# session state bound functions that act as endpoints,
2-
# so the internal funtions can make their session state
2+
# so the internal functions can make their session state
33
# consumption explicit and are testable (also prevents scrolling past
44
# the whole documentation :D )
55

@@ -888,7 +888,7 @@ function Should-Invoke {
888888
#
889889
# Mock FunctionUnderTest {}
890890
#
891-
# Consider the normal expection:
891+
# Consider the normal expectation:
892892
# `Should -Invoke FunctionUnderTest -ExclusiveFilter { $param1 -eq 'one' }`
893893
#
894894
# | Invocations | Should raises an error |
@@ -1153,7 +1153,7 @@ function Invoke-Mock {
11531153
}
11541154
}
11551155
else {
1156-
# not the targetted module, skip it
1156+
# not the targeted module, skip it
11571157
if ($PesterPreference.Debug.WriteDebugMessages.Value) {
11581158
Write-PesterDebugMessage -Scope Mock -Message "Behavior is not from the target module $(if ($targettingAModule) { $TargetModule } else { '$null' }), skipping it:`n$(& $getBehaviorMessage $b)"
11591159
}
@@ -1192,7 +1192,7 @@ function Invoke-Mock {
11921192
}
11931193
}
11941194

1195-
# if we are targetting a module use the behaviors for the current module, but if there is no default the fall back to the non-module default behavior.
1195+
# if we are targeting a module use the behaviors for the current module, but if there is no default the fall back to the non-module default behavior.
11961196
# do not fallback to non-module filtered behaviors. This is here for safety, and for compatibility when doing Mock Remove-Item {}, and then mocking in module
11971197
# then the default mock for Remove-Item should be effective.
11981198
$behaviors = if ($targettingAModule) {
@@ -1210,7 +1210,7 @@ function Invoke-Mock {
12101210
$moduleBehaviors
12111211
}
12121212
else {
1213-
# we are not targetting a mock in a module use the non module behaviors
1213+
# we are not targeting a mock in a module use the non module behaviors
12141214
if ($null -ne $nonModuleDefaultBehavior) {
12151215
# add the default non-module behavior if we have any
12161216
$nonModuleBehaviors.Add($nonModuleDefaultBehavior)

0 commit comments

Comments
 (0)