ISESteroids comes with TAB expansion of code snippets which is really easy to use. Actually this is how easy it is:
You just type a shortcut and press TAB to expand it.
There is also little to memorize. The Describe is dsc, the Context is ctx and the assertions use the first letter of each word for shortcut. The only exception is Should Be NullOrEmpty which is just sbn and not sbnoe.
Here is list of all the snippets available:
|ctx||Context||Add empty Pester Context block|
|dsc||Describe||Add empty Pester Describe block|
|it||It||Add empty Pester It block|
|sb||Should Be||Add Pester Should Be assertion|
|sbgt||Should Be Greater Than||Add Pester Should BeGreaterThan assertion|
|sblt||Should Be Less Than||Add Pester Should BeLessThan assertion|
|sbn||Should Be NullOrEmpty||Add Pester Should BeNullOrEmpty assertion|
|sc||Should Contain||Add Pester Should Contain assertion|
|se||Should Exist||Add Pester Should Exist assertion|
|sm||Should Match||Add Pester Should Match assertion|
|st||Should Throw||Add Pester Should Throw assertion|
|snb||Should Not Be||Add Pester Should Be assertion|
|snbn||Should Not BeNullOrEmpty||Add Pester Should Not BeNullOrEmpty assertion|
|snc||Should Not Contain||Add Pester Should Not Contain assertion|
|sne||Should Not Exist||Add Pester Should Not Exist assertion|
|snm||Should Not Match||Add Pester Should Not Match assertion|
|snt||Should Not Throw||Add Pester Should Not Throw assertion|
Installing the snippets
Installing the snippets is easy as well. Update your copy of Pester to the latest version (3.3.1) and import it before importing the latest version of ISESteroids (126.96.36.199).
The easiest way to do that is importing both modules in your ISE profile.
This is how you do that:
- Expand additional menu to access All tools
- Open the ISE profile
- Add calls to Import-Module as shown in picture
- Restart ISE
As noted by Tobias Weltner, author of ISESteroids: Beginning with the current release 188.8.131.52 loading other modules before ISESteroids should not matter anymore. Loading snippets is still done on startup only though, so you have to load Pester first.