Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/stale-9
Browse files Browse the repository at this point in the history
  • Loading branch information
vicperdana authored Sep 4, 2024
2 parents 834dc42 + c055109 commit b6db145
Show file tree
Hide file tree
Showing 22 changed files with 442 additions and 350 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: Invoke-Build -Configuration Release

- name: Upload module
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Module
path: ./out/modules/PSDocs/*
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
run: ./scripts/pipeline-deps.ps1

- name: Download module
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: Module
path: ./out/modules/PSDocs
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ src/**/*-help.xml
src/**/*.help.txt
BenchmarkDotNet.Artifacts/
PSDocs.Benchmark*.log
.idea/.idea.PSDocs/.idea/.gitignore
.idea/.idea.PSDocs/.idea/indexLayout.xml
.idea/.idea.PSDocs/.idea/vcs.xml
16 changes: 11 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
## Unreleased

What's changed since v0.9.0:

- Update maintainer.
- Engineering:
- Bump YamlDotNet to v13.7.1.
[#284](https://github.com/microsoft/PSDocs/pull/284)
- Bump Newtonsoft.Json to v13.0.3.
[#284](https://github.com/microsoft/PSDocs/pull/284)
- CI update Pester to v5.6.1
- Bump BenchmarkDotNet to v0.14.0.
- Bump Microsoft.CodeCoverage to v17.10.0.
- Bump Microsoft.NET.Test.Sdk to v17.10.0.
- Bump xunit to v2.9.0.
- Bump xunit.runner.visualstudio to v2.5.7.
- Bump YamlDotNet to v13.7.1.
[#284](https://github.com/microsoft/PSDocs/pull/284)
- Bump Newtonsoft.Json to v13.0.3.
[#284](https://github.com/microsoft/PSDocs/pull/284)

## v0.9.0

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ or contact [[email protected]](mailto:[email protected]) with any addi
## Maintainers

- [Bernie White](https://github.com/BernieWhite)
- [Vic Perdana](https://github.com/vicperdana)

## License

Expand Down
2 changes: 1 addition & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": {},
"devDependencies": {
"Pester": {
"version": "4.10.1"
"version": "5.6.1"
},
"platyPS": {
"version": "0.14.2"
Expand Down
30 changes: 19 additions & 11 deletions pipeline.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -191,35 +191,43 @@ task Dependencies NuGet, {

# Synopsis: Test the module
task TestModule Dependencies, {
Import-Module Pester -RequiredVersion 4.10.1 -Force;
Import-Module Pester -RequiredVersion 5.6.1 -Force;

# Run Pester tests
$pesterParams = @{ Path = $PWD; OutputFile = 'reports/pester-unit.xml'; OutputFormat = 'NUnitXml'; PesterOption = @{ IncludeVSCodeMarker = $True }; PassThru = $True; };
# Define Pester configuration
$pesterConfig = [PesterConfiguration]::Default
$pesterConfig.Run.PassThru = $True
# Enable NUnitXml output
$pesterConfig.TestResult.OutputFormat = "NUnitXml"
$pesterConfig.TestResult.OutputPath = 'reports/pester-unit.xml'
$pesterConfig.TestResult.Enabled = $True

if ($CodeCoverage) {
$pesterParams.Add('CodeCoverage', (Join-Path -Path $PWD -ChildPath 'out/modules/**/*.psm1'));
$pesterParams.Add('CodeCoverageOutputFile', (Join-Path -Path $PWD -ChildPath reports/pester-coverage.xml));
$pesterConfig.CodeCoverage.OutputFormat = 'JaCoCo'
$pesterConfig.CodeCoverage.OutputPath = 'reports/pester-coverage.xml'
$pesterConfig.CodeCoverage.Path = (Join-Path -Path $PWD -ChildPath 'out/modules/**/*.psm1')
}

if (!(Test-Path -Path reports)) {
$Null = New-Item -Path reports -ItemType Directory -Force;
}

if ($Null -ne $TestGroup) {
$pesterParams['Tags'] = $TestGroup;
$pesterConfig.Filter.Tag = $TestGroup
}

$results = Invoke-Pester @pesterParams;
# Run Pester tests
$results = Invoke-Pester -Configuration $pesterConfig

# Throw an error if pester tests failed
# Throw an error if Pester tests failed
if ($Null -eq $results) {
throw 'Failed to get Pester test results.';
throw 'Failed to get Pester test results.'
}
elseif ($results.FailedCount -gt 0) {
throw "$($results.FailedCount) tests failed.";
elseif ($results.Result.FailedCount -gt 0) {
throw "$($results.Result.FailedCount) tests failed."
}
}


task Benchmark {
if ($Benchmark -or $BuildTask -eq 'Benchmark') {
dotnet run --project src/PSDocs.Benchmark -f net7.0 -c Release -- benchmark --output $PWD;
Expand Down
2 changes: 1 addition & 1 deletion src/PSDocs.Benchmark/PSDocs.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup Condition="'$(OS)' != 'Windows_NT'">
<PackageReference Include="BenchmarkDotNet" Version="0.13.9" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
</ItemGroup>

<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
Expand Down
39 changes: 21 additions & 18 deletions tests/PSDocs.Tests/PSDocs.BlockQuote.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,30 @@
[CmdletBinding()]
param ()

# Setup error handling
$ErrorActionPreference = 'Stop';
Set-StrictMode -Version latest;

# Setup tests paths
$rootPath = $PWD;
Import-Module (Join-Path -Path $rootPath -ChildPath out/modules/PSDocs) -Force;
$here = (Resolve-Path $PSScriptRoot).Path;
$nl = [System.Environment]::NewLine;
BeforeAll{
# Setup error handling
$ErrorActionPreference = 'Stop';
Set-StrictMode -Version latest;

# Setup tests paths
$rootPath = $PWD;
Import-Module (Join-Path -Path $rootPath -ChildPath out/modules/PSDocs) -Force;
$here = (Resolve-Path $PSScriptRoot).Path;
$nl = [System.Environment]::NewLine;
}
Describe 'PSDocs -- BlockQuote keyword' -Tag BlockQuote {
$docFilePath = Join-Path -Path $here -ChildPath 'FromFile.Keyword.Doc.ps1';
$testObject = [PSCustomObject]@{
Name = 'TestObject'
}


Context 'Markdown' {
$invokeParams = @{
Path = $docFilePath
InputObject = $testObject
PassThru = $True
BeforeAll{
$docFilePath = Join-Path -Path $here -ChildPath 'FromFile.Keyword.Doc.ps1';
$testObject = [PSCustomObject]@{
Name = 'TestObject'
}
$invokeParams = @{
Path = $docFilePath
InputObject = $testObject
PassThru = $True
}
}
It 'Should handle single line input' {
$result = Invoke-PSDocument @invokeParams -Name 'BlockQuoteSingleMarkdown';
Expand Down
37 changes: 20 additions & 17 deletions tests/PSDocs.Tests/PSDocs.Code.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,30 @@
[CmdletBinding()]
param ()

# Setup error handling
$ErrorActionPreference = 'Stop';
Set-StrictMode -Version latest;
BeforeAll {
# Setup error handling
$ErrorActionPreference = 'Stop';
Set-StrictMode -Version latest;

# Setup tests paths
$rootPath = $PWD;
Import-Module (Join-Path -Path $rootPath -ChildPath out/modules/PSDocs) -Force;
$here = (Resolve-Path $PSScriptRoot).Path;
$nl = [System.Environment]::NewLine;
# Setup tests paths
$rootPath = $PWD;
Import-Module (Join-Path -Path $rootPath -ChildPath out/modules/PSDocs) -Force;
$here = (Resolve-Path $PSScriptRoot).Path;
$nl = [System.Environment]::NewLine;
}

Describe 'PSDocs -- Code keyword' -Tag Code {
$docFilePath = Join-Path -Path $here -ChildPath 'FromFile.Keyword.Doc.ps1';
$testObject = [PSCustomObject]@{
Name = 'TestObject'
}

Context 'Markdown' {
$invokeParams = @{
Path = $docFilePath
InputObject = $testObject
PassThru = $True
BeforeAll {
$docFilePath = Join-Path -Path $here -ChildPath 'FromFile.Keyword.Doc.ps1';
$testObject = [PSCustomObject]@{
Name = 'TestObject'
}
$invokeParams = @{
Path = $docFilePath
InputObject = $testObject
PassThru = $True
}
}
It 'Should have generated output' {
$result = Invoke-PSDocument @invokeParams -Name 'CodeMarkdown';
Expand Down
Loading

0 comments on commit b6db145

Please sign in to comment.