Skip to content

Commit

Permalink
chore: Update dependencies and gitignore (#314)
Browse files Browse the repository at this point in the history
Update dependencies to the latest versions:

BenchmarkDotNet from 0.13.9 to 0.14.0
Microsoft.CodeCoverage from 17.7.2 to 17.10.0
Microsoft.NET.Test.Sdk from 17.7.2 to 17.10.0
xunit from 2.5.3 to 2.9.0
xunit.runner.visualstudio from 2.5.3 to 2.5.7
Pester update to 5.6.1
Fix to CVE-2024-42471

Also, update the .gitignore file to exclude the .idea/.idea.PSDocs/.idea/ directory.
  • Loading branch information
vicperdana authored Sep 4, 2024
1 parent f653084 commit e085c52
Show file tree
Hide file tree
Showing 21 changed files with 440 additions and 349 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
14 changes: 10 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
What's changed since v0.9.0:

- 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
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 e085c52

Please sign in to comment.