Pester icon indicating copy to clipboard operation
Pester copied to clipboard

Add Assert assertions to Pester

Open nohwnd opened this issue 1 year ago • 4 comments

Fix #1423

PR Summary

This PR adds assertions from Assert module to Pester, to serve as a base for future assertions and to live side-by-side with the existing Should assertions that are based on parameter sets.

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 Request to mark it as a draft. PR can be marked Ready for review when it's ready.
  • [x] Tests are added/update (if required)
  • [ ] Documentation is updated/added (if required)

nohwnd avatar Apr 02 '24 20:04 nohwnd

We should probably decide on #2381 soon, so these assertions can either implement it - or not. 🙂

fflaten avatar Apr 02 '24 20:04 fflaten

/azp run

nohwnd avatar Apr 21 '24 18:04 nohwnd

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

azure-pipelines[bot] avatar Apr 21 '24 18:04 azure-pipelines[bot]

This PR is getting too much, will start refactoring the existing assertions towards common pattern (to make them more similar to the current Should -* assertions), instead of adding new ones.

  • [x] rename all files to Should-*
  • [x] rename all test files to should-*, and use Should-Assertions in the tests instead of Assert- to make sure we export them. Get rid of inpestermodulescope
  • [x] review messages so they look similar to existing assertions
  • [x] write help
  • [x] make type specific assertions require that type (e.g. should-*string needs string input)
  • [ ] Fix assertion for collections - will do later
  • [x] Make sure that assertions throw for no input?

nohwnd avatar Apr 24 '24 07:04 nohwnd

Should be good enough to release in 6.0.0-alpha1 so we can get other people to look at this. Please give at another quick review @fflaten .

nohwnd avatar May 18 '24 13:05 nohwnd

With 7k linediff I can't promise "quick", but I'll try tomorrow when my browser is done rendering the diff. 🙂 I'll trust your tests for functionality.

fflaten avatar May 18 '24 20:05 fflaten

I've fixed all the suggestions, and what I did not fix I moved to issues :) Pls approve.

nohwnd avatar May 20 '24 21:05 nohwnd