Giter Club home page Giter Club logo

docs's Introduction

Pester

💵 Please consider sponsoring nohwnd, fflaten or sponsoring Pester itself.

🌵 Documentation is available at https://pester.dev/docs/quick-start.

📦🔐 Pester is now signed. -SkipPublisherCheck should no longer be used to install from PowerShell Gallery on Windows 10.

📦🔐 Upgrading to 5.6.0 will show a "certificate changed" error, this is because a change in Root Certificate, and you have to specify -SkipPublisherCheck to update. More info below.

👩👨 We are looking for contributors! All issues labeled help wanted are up for grabs. They further split up into good first issue that are issues I hope are easy to solve. Bad first issue where I expect the implementation to be problematic or needs to be proposed and discussed beforehand. And the rest which is somewhere in the middle. If you decide to pick up an issue please comment in the issue thread so others don't waste their time working on the same issue as you. There is also contributor's guide that will hopefully help you.

Pester is the ubiquitous test and mock framework for PowerShell.

BeforeAll {
    # your function
    function Get-Planet ([string]$Name='*')
    {
        $planets = @(
            @{ Name = 'Mercury' }
            @{ Name = 'Venus'   }
            @{ Name = 'Earth'   }
            @{ Name = 'Mars'    }
            @{ Name = 'Jupiter' }
            @{ Name = 'Saturn'  }
            @{ Name = 'Uranus'  }
            @{ Name = 'Neptune' }
        ) | foreach { [PSCustomObject]$_ }

        $planets | where { $_.Name -like $Name }
    }
}

# Pester tests
Describe 'Get-Planet' {
  It "Given no parameters, it lists all 8 planets" {
    $allPlanets = Get-Planet
    $allPlanets.Count | Should -Be 8
  }

  Context "Filtering by Name" {
    It "Given valid -Name '<Filter>', it returns '<Expected>'" -TestCases @(
      @{ Filter = 'Earth'; Expected = 'Earth' }
      @{ Filter = 'ne*'  ; Expected = 'Neptune' }
      @{ Filter = 'ur*'  ; Expected = 'Uranus' }
      @{ Filter = 'm*'   ; Expected = 'Mercury', 'Mars' }
    ) {
      param ($Filter, $Expected)

      $planets = Get-Planet -Name $Filter
      $planets.Name | Should -Be $Expected
    }

    It "Given invalid parameter -Name 'Alpha Centauri', it returns `$null" {
      $planets = Get-Planet -Name 'Alpha Centauri'
      $planets | Should -Be $null
    }
  }
}

Save this code example in a file named Get-Planet.Tests.ps1, and run Invoke-Pester Get-Planet.Tests.ps1, or just press F5 in VSCode.

Learn how to start quick with Pester in our docs.

The example above also has an annotated and production ready version here.

Installation

Pester runs on Windows, Linux, MacOS and anywhere else thanks to PowerShell. It is compatible with Windows PowerShell 5.1 and PowerShell 7.2 and newer.

Pester 3 comes pre-installed with Windows 10, but we recommend updating, by running this PowerShell command as administrator:

Install-Module -Name Pester -Force

Not running Windows 10 or facing problems? See the full installation and update guide.

Signing certificates

The certificate used for signing the code has changed in 5.6.0. Error is shown when updating the module. Below is the list of the certificates you can expect to be used when importing the module (going back to 2016)

Version Authority Thumbprint
6.0.0-alpha4+ CN=DigiCert Trusted G4 Code Signing RSA4096 SHA384 2021 CA1, O="DigiCert, Inc.", C=US 147C2FD397677DC76DD198E83E7D9D234AA59D1A
5.6.0+ CN=DigiCert Trusted G4 Code Signing RSA4096 SHA384 2021 CA1, O="DigiCert, Inc.", C=US 2FCC9148EC2C9AB951C6F9654C0D2ED16AF27738
5.2.0 - 5.5.0 CN=DigiCert SHA2 Assured ID Code Signing CA, OU=www.digicert.com, O=DigiCert Inc, C=US C7B0582906E5205B8399D92991694A614D0C0B22
4.10.0 - 5.1.1 CN=DigiCert SHA2 Assured ID Code Signing CA, OU=www.digicert.com, O=DigiCert Inc, C=US 7B9157664392D633EDA2C0248605C1C868EBDE43
4.4.3 - 4.9.0 CN=DigiCert SHA2 Assured ID Code Signing CA, OU=www.digicert.com, O=DigiCert Inc, C=US CC1168BAFCDA3B1A5E532DA87E80A4DD69BCAEB1
3.0.3 - 4.4.2 No Certificate Found No Certificate Found
3.4.0 CN=Microsoft Windows Production PCA 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US 71F53A26BB1625E466727183409A30D03D7923DF

In all cases, except for version 3.4.0 that was signed directly by Microsoft, the Authenticode issuer for certificate is CN=Jakub Jareš, O=Jakub Jareš, L=Praha, C=CZ.

To successfully update the module when certificate changed, you need to provide -SkipPublisherCheck to the Install-Module command.

Features

Test runner

Pester runs your tests and prints a nicely formatted output to the screen.

test run output

Command line output is not the only output option, Pester also integrates with Visual Studio Code, Visual Studio, and any tool that can consume nUnit XML output.

Assertions

Pester comes with a suite of assertions that cover a lot of common use cases. Pester assertions range from very versatile, like Should -Be, to specialized like Should -Exists. Here is how you ensure that a file exists:

Describe 'Notepad' {
    It 'Exists in Windows folder' {
        'C:\Windows\notepad.exe' | Should -Exist
    }
}

Learn more about assertions in our documentation.

Mocking

Pester has mocking built-in. Using mocks you can easily replace functions with empty implementation to avoid changing the real environment.

function Remove-Cache {
    Remove-Item "$env:TEMP\cache.txt"
}

Describe 'Remove-Cache' {
    It 'Removes cached results from temp\cache.text' {
        Mock -CommandName Remove-Item -MockWith {}

        Remove-Cache

        Should -Invoke -CommandName Remove-Item -Times 1 -Exactly
    }
}

Learn more about Mocking here.

Code coverage

Pester can measure how much of your code is covered by tests and export it to JaCoCo format that is easily understood by build servers.

JaCoCo code coverage report

Learn more about code coverage here.

Build server integration

Pester integrates nicely with TFS, AppVeyor, TeamCity, Jenkins and other CI servers.

Testing your scripts, and all pull requests on AppVeyor is extremely simple. Just commit this appveyor.yml file to your repository, and select your repository on the AppVeyor website:

version: 1.0.{build}
image:
  - Visual Studio 2017
  - Ubuntu
install:
  - ps: Install-Module Pester -Force -Scope CurrentUser
build: off
test_script:
  - ps: Invoke-Pester -EnableExit

See it in action here! If you do not need to test your scripts against PowerShell Core, just simply remove the entire line mentioning Ubuntu.

Pester itself is built on AzureDevOps, and distributed mainly via PowerShell gallery.

Build Status latest version downloads

Further reading

Do you like what you see? Learn how to use Pester with our quick start guide.

Got questions?

Got questions or you just want to get in touch? Use our issues page or one of these channels:

Pester Twitter Pester on StackOverflow Testing channel on Powershell Slack Testing channel on Powershell Discord or try github discussions GitHub discussions.

Sponsored by

Pester is sponsored by Octopus Deploy.

Octopus deploy

As well as all the great folks on OpenCollective and GitHub.

Contributors

Code Contributors

This project exists thanks to all the people who contribute. Contribute code.

Financial Contributors on Open Collective

Become a financial contributor and help us sustain our community. Contribute to Pester Open Collective.

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. Contribute

docs's People

Contributors

aspenforester avatar bravo-kernel avatar cboos avatar corridorroute avatar dependabot[bot] avatar fflaten avatar ggorlen avatar github-actions[bot] avatar glennsarti avatar graememeyer avatar gtorres avatar hc-jb-lewis avatar hobadee avatar lex111 avatar mahomedalid avatar marvtherobot avatar miiitch avatar mikepowell avatar mikeybronowski avatar nohwnd avatar oasaleh avatar obesser avatar petervandivier avatar rmbolger avatar robhalevt avatar simonsabin avatar vcalatayud avatar vexx32 avatar visualstuart avatar z-ra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docs's Issues

The first Pester5 Mocking example does not work

If you copy paste the example on a ps1 file and invoke-pester it is looking for a file that does not exist. This is the example:

function Build ($version) {
    Write-Host "a build was run for version: $version"
}

function BuildIfChanged {
    $thisVersion = Get-Version
    $nextVersion = Get-NextVersion
    if ($thisVersion -ne $nextVersion) { Build $nextVersion }
    return $nextVersion
}

$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"

Describe "BuildIfChanged" {
    Context "When there are Changes" {
        Mock Get-Version {return 1.1}
        Mock Get-NextVersion {return 1.2}
        Mock Build {} -Verifiable -ParameterFilter {$version -eq 1.2}

        $result = BuildIfChanged

        It "Builds the next version" {
            Assert-VerifiableMocks
        }
        It "returns the next version number" {
            $result | Should Be 1.2
        }
    }
    Context "When there are no Changes" {
        Mock Get-Version { return 1.1 }
        Mock Get-NextVersion { return 1.1 }
        Mock Build {}

        $result = BuildIfChanged

        It "Should not build the next version" {
            Assert-MockCalled Build -Times 0 -ParameterFilter {$version -eq 1.1}
        }
    }
}

I think it has not been yet migrated to Pester5. These are the minimum changes I had to apply to make it work:

BeforeAll{
    function Build ($version) {
        Write-Host "a build was run for version: $version"
    }
    
    function Get-Version{
        return 'Version'
    }
    
    function Get-NextVersion {
        return 'NextVersion'
    }
    
    function BuildIfChanged {
        $thisVersion = Get-Version
        $nextVersion = Get-NextVersion
        if ($thisVersion -ne $nextVersion) { Build $nextVersion }
        return $nextVersion
    }
}

Describe "BuildIfChanged" {
    Context "When there are Changes" {
        BeforeEach{
            Mock Get-Version {return 1.1}
            Mock Get-NextVersion {return 1.2}
            Mock Build {} -Verifiable -ParameterFilter {$version -eq 1.2}
    
            $result = BuildIfChanged
        }

        It "Builds the next version" {
            Assert-VerifiableMock
        }
        
        It "returns the next version number" {
            $result | Should -Be 1.2
        }
    }
    Context "When there are no Changes" {
        BeforeEach{
            Mock Get-Version { return 1.1 }
            Mock Get-NextVersion { return 1.1 }
            Mock Build {}
    
            $result = BuildIfChanged
        }

        It "Should not build the next version" {
            Assert-MockCalled Build -Times 0 -ParameterFilter {$version -eq 1.1}
        }
    }
}

They are on this PR #66

Thanks for your work! :)

Installing from sources is incorrect

Installing from sources is incorrect for v5. It states that you can just download the Pester source and run it build it requires build. We can either:

  • redirect it to downloading and extracting the psgallery nuget package
  • remove that section entirely
  • redirect to build instructions
  • start publishing the module as zip

The first options is probably the best and I already checked that you can just Manual Download and unzip.

Remove duplicate references on same page

Pages contains multiple links to the same page which does not really make sense and makes reading the docs more difficult/distracting.

An example: Invoke-Pester is referenced as a link on the quick-start page multiple times.

Updating help automatically from latest release

File changes

The generate-command-reference.ps1 script:

  • only generates the .mdx files and the docusaurus.sidebar.js file found in this docs\command directory
  • then replaces the existing content of above folder with the newly generated mdx files
  • only mdx file changes will appear in the PR

The process

We already have a working process, it just needs some fine tuning IMO.

  1. Do not move generate script out of the pester/docs repo
  2. Update the generate script so it no longer uses a fixed Pester version but either:
    • uses latest Pester version (by default)
    • uses a specified Pester version if parameter is given (e.g. -PesterVersion)
  3. Use that updated script to implement CI/CD

CI/CD

A solution was discussed earlier, something like:

  1. pester/pester repo creates a new release
  2. pester/pester release triggers a github action in the pester/docs repo
  3. that pester/docs action uses the generate script to:
    • regenerate the mdx files using LATEST pester version
    • create a PR with the mdx file changes

This way everything stays as it is now with wesbite-previews etc. and.. no need to move pester-docs-related logic into the pester/pester repo.

Does that make sense?

Originally posted by @bravo-kernel in pester/Pester#1798 (comment)

Update landing page slogans

These three slogans are still Docusaurus defaults and need to be updated.

Code found in src/pages/index.js

image

Missing an argument for parameter 'InFile'

I am getting the error below pointed to function GetHTTPHeader ($url)

ParameterBindingException: Missing an argument for parameter 'InFile'. Specify a parameter of type 'System.String' and try again.

https://pester.dev/docs/usage/mocking#mocking-a-native-application

Describe 'Mocking native commands' {
    It "Mock bash" {
        function GetHTTPHeader ($url) {
            & curl --url $url `
            -I
        }

        Mock curl { Write-Warning "$args" }

        GetHTTPHeader -url "https://google.com"

        Should -Invoke -CommandName "curl" -Exactly -Times 1 -ParameterFilter { $args[0] -eq '--url' -and $args[1] -eq 'https://google.com'}

        # By converting args to string (will concat using space by default) you can match a pattern if order might change. remember linebreaks
        Should -Invoke -CommandName "curl" -Exactly -Times 1 -ParameterFilter { "$args" -match "--url https://google.com -I" }
    }
}

How can I fix this?

Pester version: 5.3.1

Theme Specifications

IMPORTANT

Please do NOT provide feedback here but instead on the theme preview PR at #29.


Theme specifications

https://v2.docusaurus.io/docs/styling-layout

General

Most important: similar to https://powershellgallery.com, at least applied to:

  • color palette
  • typography (UNSURE, psgallery fonts seem small, perhaps test-run)
  • links
  • navbar (blue #004880, not black)
  • landing page hero
  • content navigation (left sidebar, right sidebar)

Logo

  • current logo including blue background looks good on black (navbar) background
  • however, logo would look better in the theme without the blue background
  • there is no .svg logo yet
    • do we really need svg and if so, why?
    • do we have the (.ai?) source files and if so, can they be used to create an svg? YES: #28 (comment)

Navbar

  • should not change color when switching between dark mode

Landing Page

In general, similar to https://componentkit.org/ with the following notes:

  • hero must have config based text and (svg?) image
  • sub heros must have config based text and (svg?) images
  • sub hero images look 'n' feel: similar to componentkit.org

Sponsors:

Instead of the Also available component on componentkit.org's landing page:

  • a component to list opencollective.com sponsors

See:

Syntax highlighting

  • might need to be updated to match new typography Dropped as it inherits main theme

Footer

Did we miss anything?

Not specified before but yes, we forgot about the styling of the sortable markdown tables, used a lot under the Additional Resources section. If possible:

  • make left column width max out (to prevent weird looking tables)
  • some pointers/help on making the sort arrow visible

Bonus features (thanks @lex111)

  • make landing page look cool on mobile too
  • add sort icons to the tables

Add-ShouldOperator reference docs do not specify parameter interface for Test scriptblock

  • Pester version: 5.1.0
  • Function: Add-ShouldOperator

General summary of the issue

The documentation for Add-ShouldOperator indicates that the -Test parameter is supposed to receive a [ScriptBlock] containing the assertion to be run. However, there isn't any documentation on how to pass in test/reference values, etc. etc. (either from the pipeline or via named/positional parameters).

I was able to find a blog post that partially covered it in passing, but some in-module documentation would be really useful here.

Some questions that a user should be able to answer from the documentation (either via examples or from the text itself) are:

  • How can I define a parameter in my test block such-that it's exposed to users when they call it via Should?
  • Are there any required/special-use parameters (e.g. $Negate)?
  • Are there any special steps required for receiving pipeline input from Should?

Cannot follow / test examples without Get-Emoji.ps1

Location

https://pester-docs.netlify.app/docs/usage/data-driven-tests

  • Pester version: 5.2.2

General summary of the issue

I'm trying to take a working copy of code (e.g. code from the documentation) and run this locally to test and tweak to help me understand how the data driven aspects of Pester behave (sometimes long documentation is harder to understand than getting hands on with things). Without Get-Emoji.ps1 it's not possible to run any of this because the function doesn't exist (obviously!). Please could this file be added to the documentation to download so we can import it? Thank you.

Implement mechanism to keep auto-generated Command Reference in-sync

All pages in the Command Reference are auto-generated using the Alt3.Docusaurus.Powershell module.

Because it uses the Get-Help documentation produced by Pester as input, it is important to implement some sort of mechanism to keep the pages in-sync with the Pester module releases. One idea talked about creating some sort of "webhook" that triggers this repo once a new Pester version is released.

Good to Know

Powershell used to generate the current command reference pages:

$pesterArgs = @{
    Module = "Pester"
    DocsFolder = "docs"
    SideBar = "commands"
    Exclude = @(
      "Get-MockDynamicParameter"
      "Invoke-Mock"
      "SafeGetCommand"
      "Set-DynamicParameterVariable"
    )
    MetaDescription = 'Help page for the Powershell Pester "%1" command'
    MetaKeywords = @(
        "Powershell"
        "Pester"
        "Help"
        "Documentation"
    )
    EditUrl = 'null' # prevents `Edit this Page` button
    AppendMarkdown = "## EDIT THIS PAGE`n`nThis page was auto-generated using Pester's comment based help. To edit the content of this page, change the corresponding help in the [pester/Pester](https://github.com/pester/pester) repository. See our [contribution guide](https://github.com/pester/docs#contributing) for more information."
}

New-DocusaurusHelp @pesterArgs -Verbose

Unable to install new version of pester using Install-Module -> https://pester.dev/docs/introduction/installation

Hi Team,
As mentioned in https://pester.dev/docs/introduction/installation , the deletion of existing version needs to be done to install the new version. The code for deleting the current one works but the installation fails. There is some fault in the code with pester. Install-Module Pester -Force -SkipPublisherCheck used to work earlier, also the update-module pester, almost a month ago, now it says, pester is not installed using install-module and cannot be updated. Its so annoying. I currently have 3.4.0 version and need 4.10.0. Suggest me how to.Please reply.

After deletion happens through
*$module = "C:\Program Files\WindowsPowerShell\Modules\Pester"
takeown /F $module /A /R
icacls $module /reset
icacls $module /grant "S-1-5-32-544:F" /inheritance:d /T
Remove-Item -Path $module -Recurse -Force -Confirm:$false
Install-Module -Name Pester -Force

It gives me this error and results in not having pester of any version because it deletes existing one and doesn't install new version
Capture1

Thank you.

Add missing front matter for keywords and description

Currently, the website pages/markdown files are missing front matter variables description and keywords which will be used as html meta tags.

Both variables should be added so the markdown looks similar to:

---
id: quick-start
title: Quick Start
sidebar_label: Quick Start
description: Some appropriate page-specific description
keywords:
  - Pester
  - Powershell
  - etc.
  - etc.
---

Replace svg logo

  • current default logo found in src/static/img/logo.svg
  • related code in docusaurus.config

Why not recommend a tests folder?

Why are the pester docs recommending a practice that almost nobody uses (not even Pester itself) of putting the test files in the source folder next to the function file? I assume this recommendation comes from writing tests for scripts vs. modules, but I don't know -- I can't find anyone that does that...

By far the most common practice is to create test folders...

None of the quick starts work

I must be missing something obvious. None of the quick start guides in these two locations work.

https://github.com/pester/Pester
https://pester.dev/docs/quick-start

Output

PS F:\git\kanopy\Scripts> Invoke-Pester  .\Get-Planet.Tests.ps1

 [-] Error occurred in test script 'F:\git\kanopy\Scripts\Get-Planet.Tests.ps1' 17ms
   RuntimeException: The BeforeAll command may only be used inside a Describe block.
   at Assert-DescribeInProgress, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\Describe.ps1: line 125
   at BeforeAll, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\SetupTeardown.ps1: line 56
   at <ScriptBlock>, F:\git\kanopy\Scripts\Get-Planet.Tests.ps1: line 1
   at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Pester.psm1: line 297
   at Invoke-Pester, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Pester.psm1: line 310
   at <ScriptBlock>, <No file>: line 1
Tests completed in 17ms
Passed: 0 Failed: 1 Skipped: 0 Pending: 0 Inconclusive: 0

Get-Planet.Tests.ps1

BeforeAll {
    # your function
    function Get-Planet ([string]$Name='*')
    {
        $planets = @(
            @{ Name = 'Mercury' }
            @{ Name = 'Venus'   }
            @{ Name = 'Earth'   }
            @{ Name = 'Mars'    }
            @{ Name = 'Jupiter' }
            @{ Name = 'Saturn'  }
            @{ Name = 'Uranus'  }
            @{ Name = 'Neptune' }
        ) | foreach { [PSCustomObject]$_ }

        $planets | where { $_.Name -like $Name }
    }
}

# Pester tests
Describe 'Get-Planet' {
  It "Given no parameters, it lists all 8 planets" {
    $allPlanets = Get-Planet
    $allPlanets.Count | Should -Be 8
  }

  Context "Filtering by Name" {
    It "Given valid -Name '<Filter>', it returns '<Expected>'" -TestCases @(
      @{ Filter = 'Earth'; Expected = 'Earth' }
      @{ Filter = 'ne*'  ; Expected = 'Neptune' }
      @{ Filter = 'ur*'  ; Expected = 'Uranus' }
      @{ Filter = 'm*'   ; Expected = 'Mercury', 'Mars' }
    ) {
      param ($Filter, $Expected)

      $planets = Get-Planet -Name $Filter
      $planets.Name | Should -Be $Expected
    }

    It "Given invalid parameter -Name 'Alpha Centauri', it returns `$null" {
      $planets = Get-Planet -Name 'Alpha Centauri'
      $planets | Should -Be $null
    }
  }
}

Replace wiki-links with valid markdown links

The website pages currently contain a lot of migrated links in the following non-markdown-compatible (wiki-specific) format:

See the documentation for [[Invoke-Pester]].

These should all be updated to use valid markdown links similar to:

See the documentation for [Invoke-Pester](../commands/Invoke-Pester).

Legacy interface is wrong

Some of the mapping value between legacy and v5 regarding the code coverage documentation are wrong in the following link https://github.com/pester/Pester#legacy-interface.

Parameter Current value for Configuration Object Property Real value
CodeCoverage CodeCoverage.Path CodeCoverage.Path
CodeCoverageOutputFile CodeCoverage.CodeCoverageOutputFile CodeCoverage.OutputPath
CodeCoverageOutputFileEncoding CodeCoverage.CodeCoverageOutputFileEncoding CodeCoverage.OutputEncoding
CodeCoverageOutputFileFormat CodeCoverage.CodeCoverageOutputFileFormat CodeCoverage.OutputFormat

Should I create a PR in this repo or in the Pester one?

Fix multi-line code examples

The Command Reference pages are not displaying multi-line examples correctly as can be seen in this example:

image

Info

  1. This issue is NOT caused by this repo
  2. Cause and additional information can be found at alt3/Docusaurus.Powershell#14
  3. Could be be solved there as well but ideally through this PlatyPS issue
  4. Requires help ❤️

Add Output usage-doc

We might want to add a page showing the difference in output verbosity and the future stacktrace verbosity.

IIRC this is only mentioned quickly in VSCode + Diagnostic-level in Troubleshooting.

Documentation Request - adding more "Why do I test" stuff

All,

I was thinking that perhaps I should add a version of my "Beyond Pester 101" and "Beyond Pester 102" talks into this docs repo. However before I start (as it would be a large piece of work) I'd like to make sure it would sit in the vision that the Pester team has for this Docs repo.

Does this sound like something the team would find useful?

Need guidance for how to run v4 and v5 side-by-side

v5 is a massive breaking change. Anyone with a sizeable body of v4 tests will not be able to migrate all at once, and may not even own the ability to migrate completely. For migration to be possible for such people, they need to know how to run v5 for 1%, 10% or 90% of their tests, and still be able to run the remainder with v4.

Tips needed:

  1. How to install both v4 and v5 side-by-side, such that v4 is the default version
  2. How to annotate v5 tests so that v5 is used automatically when they are run
    • Should also mention how to annotate v4 tests for clarity, but recognize that it may be impossible to change some legacy content

A focus on this scenario will improve v5 adoption dramatically. (speaking from experience on breaking changes in general, and the lack of tools for dealing with the move to v5 has also been an inhibiting factor for me personally)

Rename master to main

@bravo-kernel I'd like to rename master to main to keep up with the new naming standards. I know that I need to change it in Netlify, and there are bunch of mentions in the repo as well.

Is there anything else that I don't see?

Visuals TODO list

TODO list for when we seek help from someone who can style Docusaurus:


Caution block that is emited when

:::caution
blah blah
:::

is used in the .mdx has poor contrast.

^^^
Nothing wrong with code, but these blocks should probably have more contrast. Can be hard to read in light mode.

Originally posted by @fflaten in #70 (comment)


Switching to dark mode not all items are switched, (this started happening after the version dropdown).


Pester logo turns black on hover.

Need documentation on $PesterBoundParameters and forwarding strategy

I spent a lot of time trying to figure out how to do something pretty simple:

        Mock Copy-Item {
            $originalCopyItem = Get-Command Copy-Item -CommandType Cmdlet
            & $originalCopyItem @PesterBoundParameters
        }

There are actually two things here that I think should be documented:

  1. How to mock something, but still call the original something from within the mock; and
  2. How to generically forward parameters to that original thing (@PesterBoundParameters).

While not needed for most mocks, this is a valuable technique, and deserves to be mentioned somewhere.

Fix Get-Help links (in the Pester source files)

The auto-generated Command Reference pages use the Get-Help information produced by Pester. PlatyPS is used to make the first conversion to markdown, Alt3.Docusaurus.Powershell then enriches the markdown so it becomes compatible with Docusaurus.

The Pester sources may contain Get-Help .LINK sections which are converted to External Links as shown below:

image

As you can see there are currently two issues, to be fixed in the Pester source file:

  1. the link to the wiki is no longer valid
  2. the second link uses a wiki-specific ref that is no longer valid

Another issue that might occur in the source files is this example taken from https://github.com/pester/Pester/blob/master/Functions/Mock.ps1:

.LINK
Assert-MockCalled
Assert-VerifiableMock
Describe
Context
It
about_Should
about_Mocking

which leads to this funky link in the browser:

image

Should be fixed by creating separate .LINK entities as per the specification. E.g.

.LINK
    Assert-MockCalled

.LINK
    Assert-VerifiableMock

.LINK
    Describe

.LINK
    Context

.LINK
    It

.LINK
    about_Should

.LINK
    about_Mocking

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.