* Validate the `includeIgnored` patterns: an array of non-empty gitignore-style * strings. A non-array value or a non-string/blank entry warns-and-skips; never * throws. Patterns are kept verbatim (trimmed) so they match exactly as a * `.gitignore` line would.
(parsed: object, file: string)
| 192 | * `.gitignore` line would. |
| 193 | */ |
| 194 | function extractIncludeIgnored(parsed: object, file: string): string[] { |
| 195 | const raw = (parsed as ProjectConfig).includeIgnored; |
| 196 | if (raw === undefined) return []; |
| 197 | if (!Array.isArray(raw)) { |
| 198 | logWarn(`Ignoring "includeIgnored" in ${PROJECT_CONFIG_FILENAME}: must be an array of gitignore-style patterns`, { file }); |
| 199 | return []; |
| 200 | } |
| 201 | |
| 202 | const out: string[] = []; |
| 203 | for (const entry of raw) { |
| 204 | if (typeof entry !== 'string' || !entry.trim()) { |
| 205 | logWarn(`Ignoring an "includeIgnored" entry in ${PROJECT_CONFIG_FILENAME}: every pattern must be a non-empty string`, { file }); |
| 206 | continue; |
| 207 | } |
| 208 | out.push(entry.trim()); |
| 209 | } |
| 210 | return out; |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Validate the `exclude` patterns: an array of non-empty gitignore-style |
no test coverage detected