Commit 8fb8fda
committed
🚜 [refactor] Make Invoke-ShouldProcess an advanced, testable evaluator
- Add [CmdletBinding(SupportsShouldProcess = $true)] to Invoke-ShouldProcess so it can honor ShouldProcess semantics as an advanced function.
- Introduce $script:ShouldProcessEvaluator and evaluate it first (if provided) to allow higher-priority, test-injectable decision logic while preserving existing ShouldProcessOverride and fallback behavior.
🛠️ [fix] Remove Console.IsOutputRedirected dependency from emission test
- Change Test-ColorScriptTextEmission to stop relying on [Console]::IsOutputRedirected and only respect -ReturnText when deciding text emission, improving compatibility with stubbed/redirected hosts.
🧪 [test] Update tests to match new evaluator behavior, robust path matching, and updated statuses
- Relax macOS cache path assertions to accept both '/' and '\' and anchor to end-of-string.
- Broaden cache-dir expectation to match 'ColorScripts-Enhanced([/\\]cache)?$'.
- Update cache build/clear tests to use the new ShouldProcessEvaluator and expect operations declined by the user to be reported as 'SkippedByUser'.
- Revise Export-ColorScriptMetadata test to mock Get-ColorScriptEntry, simulate cache read failure via Get-Item, write returned JSON to the output path, and assert that Write-Verbose was called for cache-info read failures.
Signed-off-by: Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com>1 parent 53dbd62 commit 8fb8fda
9 files changed
Lines changed: 69 additions & 313 deletions
File tree
- ColorScripts-Enhanced
- en-US
- Tests
- dist
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
137 | 142 | | |
138 | 143 | | |
139 | 144 | | |
| |||
840 | 845 | | |
841 | 846 | | |
842 | 847 | | |
843 | | - | |
| 848 | + | |
844 | 849 | | |
845 | 850 | | |
846 | 851 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2156 | 2156 | | |
2157 | 2157 | | |
2158 | 2158 | | |
2159 | | - | |
| 2159 | + | |
2160 | 2160 | | |
2161 | 2161 | | |
2162 | 2162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
622 | | - | |
| 622 | + | |
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| |||
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
802 | | - | |
| 802 | + | |
803 | 803 | | |
804 | 804 | | |
805 | 805 | | |
| |||
Lines changed: 31 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | | - | |
| 399 | + | |
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| |||
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
524 | | - | |
| 524 | + | |
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
| 534 | + | |
| 535 | + | |
534 | 536 | | |
535 | | - | |
536 | | - | |
537 | | - | |
| 537 | + | |
538 | 538 | | |
539 | | - | |
540 | 539 | | |
541 | 540 | | |
542 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
543 | 553 | | |
544 | 554 | | |
545 | 555 | | |
546 | | - | |
547 | | - | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
548 | 560 | | |
549 | 561 | | |
550 | | - | |
551 | 562 | | |
552 | 563 | | |
553 | 564 | | |
554 | 565 | | |
555 | 566 | | |
556 | 567 | | |
557 | 568 | | |
558 | | - | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
559 | 574 | | |
560 | | - | |
| 575 | + | |
561 | 576 | | |
562 | 577 | | |
563 | 578 | | |
| |||
581 | 596 | | |
582 | 597 | | |
583 | 598 | | |
584 | | - | |
585 | | - | |
| 599 | + | |
| 600 | + | |
586 | 601 | | |
587 | 602 | | |
588 | 603 | | |
589 | 604 | | |
590 | | - | |
| 605 | + | |
591 | 606 | | |
592 | 607 | | |
593 | 608 | | |
| |||
0 commit comments