Run Pester Tests in containers locally and get PassThru Object back.
Use the following code to install the Module:
Find-Module DockerPester -AllowPrerelease | Install-Module -Force
Base functionality | Pipeline |
---|---|
DockerPester |
Up until now I tested it with the following Docker Images:
Install Docker on your System from here:
You can install it using Chocolatey with this Script:
Install Docker with Chocolatey
! Installs Chocolatey and Docker. If you already have Chocolatey installed just run the second line.
$Param = @{
ContainerName = "DockerPester" #Name of the Container used to Test.
Image = "mcr.microsoft.com/powershell:7.0.0-rc.2-alpine-3.8" #Image used for the Container
InputFolder = "/Users/kevin/code/PSHarmonize"#Module or Folder you pass with your Tests in them
PathOnContainer = "/var" #Path you want to copy to in your container
PathToTests = "Tests" #Path in 'InputFolder' where your Tests are located
PrerequisiteModule = "PSHTML" #Pass Modules that are prerequisites to your tests to download from gallery in container.
}
Invoke-DockerPester @Param
Parameters are described in Detail here: Parameters
Find the Documentation to set up DockerPester for your module here - NOT FINISHED
To check out how to set up DockerPester for a Project check out This BlogPost.
This is how you would add a job for your project:
And this is how you would run DockerPester against your Project: