Debugging PowerShell Modules with Pester Unit Tests in Visual Studio Code
If you are the author of a PowerShell module, you can use the built-in debugging tools in Microsoft Visual Studio Code to debug your script modules. In this video, we'll build a simple PowerShell script module, and then use the Pester unit testing module to write some failing tests. Then, we'll set a breakpoint in our module and break into the debugger when we execute the Pester unit tests. Once execution is paused, we'll step through the module code line by line, to discover where things are going wrong. We'll then fix the module code, and ensure that our Pester unit tests are passing.
Relevant Links
https://github.com/powershell/vscode-powershell
https://github.com/PowerShell/PowerShell/
https://code.visualstudio.com/docs/editor/debugging
https://twitter.com/pspester
https://github.com/pester/Pester
Why should you use PowerShell classes? https://www.youtube.com/watch?v=UgvZYJVkdow
PowerShell v5 Classes :: Property Validation Attributes: https://www.youtube.com/watch?v=mXKlRVvMkv4
PowerShell 5.0 Classes :: All About Object Constructors: https://youtu.be/wLMTlNIddds
PowerShell 5.0 Classes :: Inheritance and Base Class Methods: https://youtu.be/Lfx_H36GRKg
PowerShell 5.0 Classes :: What are .NET Enumerations? https://youtu.be/LfPr7BXRCNM
Introduction to PowerShell 5.0 Classes: https://youtu.be/gjaR8rB_YsY
Producer: Trevor Sullivan
Website: https://trevorsullivan.net
Patreon: https://patreon.com/trevorsullivan
Twitter: https://twitter.com/pcgeek86
Gab: https://gab.ai/trevors
Intro music "Amen Tune" used, with permission, from Aaron Static. Check out his music here: https://soundcloud.com/aaronstatic
#Microsoft #PowerShell #VSCode
0:00 Intro to Debugging PowerShell Modules
2:30 Create Sample PowerShell Module
3:53 Add Function to Return Class Instance
10:10 Create Pester Test File
12:15 Add Describe Block
15:22 Debug PowerShell Module Function
19:05 Fix Bug in PowerShell Function
23:20 Run Final Successful Test
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Debugging PowerShell Modules with Pester Unit Tests in Visual Studio Code», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.