Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Pester v5 #398

Merged
merged 17 commits into from Jul 6, 2020
Merged

Update to Pester v5 #398

merged 17 commits into from Jul 6, 2020

Conversation

vexx32
Copy link
Owner

@vexx32 vexx32 commented Jun 16, 2020

PR Summary

Need to update the module for Pester v5, likely both the module tests and some of the koans themselves.

Context

This will resolve #391 fully, but will be a breaking change technically since we have to move to a new major Pester version. Many of the koans should be very compatible with Pester v5, but a complete pass is needed to ensure we aren't using any patterns in the koans that will break in Pester v5.

This also updates the code used in Measure-Koan to utilize some internal discovery mechanics of Pester. Unfortunately, using this during an ongoing test run will corrupt Pester's internal state, so the automated tests for this function have been flagged with -Skip for the time being, until a solution is found for that.

Changes

  • Update private function tests.
  • Update public function tests.
  • Update Get-Karma to retrieve the correct information from the new Pester result object.
  • Update EZOut format handlers to work correctly with the new result object types.
    • Verify these changes are working correctly.
    • Diagnose and resolve issue with formatter on MacOS (formatter only works once, and fails to retrieve meditation/koan flavor text from the module scope for display).
  • Review koan topics to ensure they're v5 compatible and make necessary changes.
    • Introduction
    • Foundations
    • Cmdlets 1
    • Cmdlets 2
    • Constructs and Patterns
    • Katas
    • Modules

Checklist

  • Pull Request has a meaningful title.
  • Summarised changes.
  • Pull Request is ready to merge & is not WIP.
  • Added tests / only testable interactively.
    • Make sure you add a new test if old tests do not effectively test the code changed.
  • Added documentation / opened issue to track adding documentation at a later date.

@vexx32 vexx32 added Category-Koans Invoking the Great Doubt Category-Module Pertaining to the module's functionality itself. Category-Build 🚀 Modifies the build / deployment system Category-Tests ✅ Pertaining to tests for the module functions. PR-Awaiting-Author ✏️ Waiting on a response from the user who submitted the PR. labels Jun 16, 2020
@vexx32 vexx32 self-assigned this Jun 16, 2020
@vexx32 vexx32 force-pushed the PesterV5 branch 5 times, most recently from 648c8ea to 03c19c8 Compare June 18, 2020 17:29
@vexx32 vexx32 closed this Jun 18, 2020
@vexx32 vexx32 reopened this Jun 18, 2020
@vexx32 vexx32 force-pushed the PesterV5 branch 3 times, most recently from f3243e6 to 2a9ee81 Compare June 19, 2020 23:16
@vexx32 vexx32 marked this pull request as ready for review June 20, 2020 16:16
@vexx32 vexx32 changed the title WIP - Update to Pester v5 Update to Pester v5 Jun 20, 2020
 - Utilize built in discovery routines for counting tests
 - Update Get-Karma/Show-Karma to reference correct result properties.
 - Update formatters to reference correct properties from result objects

:recycle: Adjustments to private functions

 - Short circuit Get-Karma when no files found
 - Remove unneeded using statements from Measure-Koan
 - Qualify type name for SMA types in New-PSKoanErrorRecord
 - Update sanity tests
 - Update private function tests
 - Update public function tests

:white_check_mark: :warning: Skip Measure-Koan tests

These tests are currently unstable and prone to corrupting Pester's
internal state. Without a better option at the moment, we'll need to
skip these tests for the time being.
The function has been manually verified and seems to be more accurate
than the original version.
♻️ Avoid corrupting process PSModulePath

 - env: provider can affect the whole process, so keep changes temporary
 - move PSModulePath changes to Invoke-Koan instead of New-KoanRunspace
 - If PSKoans is not on the module path, Measure-Koan can fail.
   We can avoid this by temporarily modifying PSModulePath.
@vexx32 vexx32 merged commit 0e0ac28 into main Jul 6, 2020
@vexx32 vexx32 deleted the PesterV5 branch July 6, 2020 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Build 🚀 Modifies the build / deployment system Category-Koans Invoking the Great Doubt Category-Module Pertaining to the module's functionality itself. Category-Tests ✅ Pertaining to tests for the module functions. PR-Awaiting-Author ✏️ Waiting on a response from the user who submitted the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pester 5.0.0 installed and the module is loading correctly, but no koan errors ever get caught
1 participant