From 61b5ab2f56bcbdcabf4ee20689973e1696b45361 Mon Sep 17 00:00:00 2001 From: Raimund Andree Date: Thu, 8 Oct 2026 10:46:31 +0000 Subject: [PATCH] test: expect the folder error of Get-NTFSHardLink as non-terminating Since a324484, Get-NTFSHardLink writes a non-terminating GetHardLinkError for a folder. The current-location test still used -ErrorAction SilentlyContinue and so no longer saw the error; -ErrorAction Stop turns it into the exception that the test expects. The first full-suite run as a basic user found it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: AI Assistant --- Tests/Owner.Tests.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/Owner.Tests.ps1 b/Tests/Owner.Tests.ps1 index 0ddc8ae..8767460 100644 --- a/Tests/Owner.Tests.ps1 +++ b/Tests/Owner.Tests.ps1 @@ -99,8 +99,9 @@ Describe 'Current location' { Should -Not -Throw } + # The error for the folder is non-terminating since 5.0.0-rc6, so -ErrorAction Stop turns it into the exception. It 'Get-NTFSHardLink should report the folder of the current location, not a NullReferenceException' { - { Invoke-WithShadowedPwd -Command { Get-NTFSHardLink -ErrorAction SilentlyContinue } } | + { Invoke-WithShadowedPwd -Command { Get-NTFSHardLink -ErrorAction Stop } } | Should -Throw -ExpectedMessage '*must be a file*' } }