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
Copy file name to clipboardExpand all lines: src/docs/Frameworks/Process-PSModule/skipping-framework-tests.md
+101-6Lines changed: 101 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,38 +58,133 @@ Here's an example of a function file that skips the `FunctionCount` test because
58
58
function Get-ComplexData {
59
59
<#
60
60
.SYNOPSIS
61
-
Retrieves complex data using helper functions.
61
+
Get formatted data from a file.
62
+
63
+
.DESCRIPTION
64
+
Read data from a file and format it as a structured object.
65
+
66
+
.EXAMPLE
67
+
Get-ComplexData -Path '.\data.txt'
68
+
69
+
Get the file content and its character count.
70
+
71
+
.INPUTS
72
+
None
73
+
74
+
You can't pipe objects to Get-ComplexData.
75
+
76
+
.OUTPUTS
77
+
System.Management.Automation.PSCustomObject
78
+
79
+
The formatted file data.
80
+
81
+
.NOTES
82
+
This file intentionally skips only the FunctionCount framework test.
83
+
84
+
.LINK
85
+
Get-RawData
62
86
#>
87
+
[OutputType([PSCustomObject])]
63
88
[CmdletBinding()]
64
89
param(
90
+
# The path to the data file.
65
91
[Parameter(Mandatory)]
92
+
[ValidateNotNullOrEmpty()]
66
93
[string] $Path
67
94
)
68
95
69
96
$data = Get-RawData -Path $Path
70
-
$processed = Format-ComplexData -Data $data
71
-
return $processed
97
+
Format-ComplexData -Data $data
72
98
}
73
99
74
100
function Get-RawData {
101
+
<#
102
+
.SYNOPSIS
103
+
Get unformatted data from a file.
104
+
105
+
.DESCRIPTION
106
+
Read the complete content of a data file as one string.
107
+
108
+
.EXAMPLE
109
+
Get-RawData -Path '.\data.txt'
110
+
111
+
Get the complete content of the data file.
112
+
113
+
.INPUTS
114
+
None
115
+
116
+
You can't pipe objects to Get-RawData.
117
+
118
+
.OUTPUTS
119
+
System.String
120
+
121
+
The unformatted file content.
122
+
123
+
.NOTES
124
+
This function is a private helper for Get-ComplexData.
125
+
126
+
.LINK
127
+
Get-Content
128
+
#>
129
+
[OutputType([string])]
75
130
[CmdletBinding()]
76
131
param(
132
+
# The path to the data file.
77
133
[Parameter(Mandatory)]
134
+
[ValidateNotNullOrEmpty()]
78
135
[string] $Path
79
136
)
80
-
# Helper function implementation
137
+
138
+
Get-Content -LiteralPath $Path -Raw
81
139
}
82
140
83
141
function Format-ComplexData {
142
+
<#
143
+
.SYNOPSIS
144
+
Format raw data as a structured object.
145
+
146
+
.DESCRIPTION
147
+
Add useful metadata to raw data while preserving its content.
148
+
149
+
.EXAMPLE
150
+
Format-ComplexData -Data 'example'
151
+
152
+
Format the string and include its character count.
153
+
154
+
.INPUTS
155
+
None
156
+
157
+
You can't pipe objects to Format-ComplexData.
158
+
159
+
.OUTPUTS
160
+
System.Management.Automation.PSCustomObject
161
+
162
+
The formatted data and its character count.
163
+
164
+
.NOTES
165
+
This function is a private helper for Get-ComplexData.
166
+
167
+
.LINK
168
+
Get-ComplexData
169
+
#>
170
+
[OutputType([PSCustomObject])]
84
171
[CmdletBinding()]
85
172
param(
173
+
# The raw content to format.
86
174
[Parameter(Mandatory)]
87
-
$Data
175
+
[ValidateNotNullOrEmpty()]
176
+
[string] $Data
88
177
)
89
-
# Helper function implementation
178
+
179
+
[PSCustomObject] @{
180
+
Content = $Data
181
+
CharacterCount = $Data.Length
182
+
}
90
183
}
91
184
```
92
185
186
+
The skip exempts only `FunctionCount`. Every function in the file must still follow the [PowerShell function standard](../../Coding-Standards/PowerShell/Functions.md), including complete comment-based help, matching `[OutputType()]` and `.OUTPUTS` metadata, typed parameters, and implicit output.
187
+
93
188
## Best Practices
94
189
95
190
-**Use skip comments sparingly**: Framework tests exist to maintain code quality and consistency. Only skip tests when absolutely necessary.
0 commit comments