From 21e8b16cecb5a8019402351db01ea696579ecb8f Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Sun, 30 Oct 2022 01:26:04 +0000 Subject: [PATCH] add log flag to run tests section in readme --- README.md | 7 +++---- tests/pre-commit.ps1 | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8537621..ca530ce 100644 --- a/README.md +++ b/README.md @@ -354,12 +354,11 @@ Run tests using .\tests\pre-commit.ps1 which accepts the following parameters: - `kind`: Run tests of this kind - `tag`: Run tests tagged with this marker (currently `higher` or `lower`) - `num`: Run this number of tests +- `log`: Write summary log file -Run tests from repository root in a subshell like so: +Run tests from repository root in a subshell and write logs, like so: -`powershell .\tests\pre-commit.ps1 -k "potato" -t "higher"` - -Results will be logged and summary file written. +`powershell .\tests\pre-commit.ps1 -k "potato" -t "higher" -log` ### Official Documentation diff --git a/tests/pre-commit.ps1 b/tests/pre-commit.ps1 index 4ef36ee..b8370f7 100644 --- a/tests/pre-commit.ps1 +++ b/tests/pre-commit.ps1 @@ -3,7 +3,7 @@ Import-Module .\lib\Voicemeeter.psm1 Function ParseLog { Param([String]$logfile) - $summary_file = "_summary.log" + $summary_file = Join-Path $PSScriptRoot "_summary.log" if (Test-Path $summary_file) { Clear-Content $summary_file } $PASSED_PATTERN = "^PassedCount\s+:\s(\d+)" @@ -57,7 +57,7 @@ function main() { $ifNotBanana = $vmr.kind.name -ne "banana" $ifNotPotato = $vmr.kind.name -ne "potato" - $logfile = "_results.log" + $logfile = Join-Path $PSScriptRoot "_results.log" if (Test-Path $logfile) { Clear-Content $logfile } 1..$num | ForEach-Object {