Pester
Pester copied to clipboard
Format single item arrays as an array
PR Summary
Single item arrays are currently printed as single item without type-specific formatting because Is-Value expands them. Arrays with a single string or bool (more types?) will not be properly formatted.
# Current
> Format-Nicely @('a')
a
# After
> Format-Nicely @('a')
@('a')
Related #2329
PR Checklist
- [x] PR has meaningful title
- [x] Summary describes changes
- [ ] PR is ready to be merged
- If not, use the arrow next to
Create Pull Requestto mark it as a draft. PR can be markedReady for reviewwhen it's ready.
- If not, use the arrow next to
- [x] Tests are added/update (if required)
- [ ] Documentation is updated/added (if required)
Submitting as a draft because I'm not sure if this might format items in an unexpected array somewhere because Pester wraps input internally. ~The broken test is fixed by #2329~
Alternative: Do extra checks inside if(Is-Value ...) { } to call Format-Bool, Format-String etc.
Thoughts @nohwnd ?
I will have a look will need to touch the formatting code for assert as well.