Skip to content

Detect Obsidian image format in markdown files #2

Detect Obsidian image format in markdown files

Detect Obsidian image format in markdown files #2

Workflow file for this run

name: Pester Tests
on:
pull_request:
branches: [ main ]
paths:
- 'src/**'
- '.github/workflows/pester-tests.yml'
push:
branches: [ main ]
paths:
- 'src/**'
- '.github/workflows/pester-tests.yml'
jobs:
test:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PowerShell Module Dependencies
shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module -Name Pester -Force -SkipPublisherCheck
Install-Module -Name PowerShell-Yaml -Force -SkipPublisherCheck
- name: Run Pester Tests
shell: pwsh
run: |
# Import the module
Import-Module ./src/PSBlogger.psd1 -Force
# Configure Pester
$PesterConfig = @{
Run = @{
Path = './src/tests'
}
Output = @{
Verbosity = 'Detailed'
}
TestResult = @{
Enabled = $true
OutputPath = 'TestResults.xml'
OutputFormat = 'NUnitXml'
}
CodeCoverage = @{
Enabled = $true
Path = './src/*.ps*1'
OutputPath = 'coverage.xml'
OutputFormat = 'JaCoCo'
}
}
# Run tests
$Results = Invoke-Pester -Configuration $PesterConfig
# Exit with error code if tests failed
if ($Results.FailedCount -gt 0) {
Write-Error "Tests failed: $($Results.FailedCount) failed out of $($Results.TotalCount) total tests"
exit 1
}
Write-Host "All tests passed: $($Results.PassedCount) out of $($Results.TotalCount) tests"
# - name: Publish Test Results
# uses: dorny/test-reporter@v1
# if: always()
# with:
# name: Pester Tests
# path: TestResults.xml
# reporter: java-junit
# fail-on-error: true
# - name: Upload Test Results
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: test-results
# path: |
# TestResults.xml
# coverage.xml
# retention-days: 7