Closed bcdady closed 2 years ago
Observations:
. (Join-Path (Join-Path (Get-Location) "Include") "TestIncludes.ps1")
) is incorrect and should be corrected to ..\Include
, for example . (Join-Path (Join-Path (Get-Location) "..\Include") "TestIncludes.ps1")
.Include\TestIncludes.ps1
has the line Import-Module ..\Deployment\AWSPowershell.NetCore\AWSPowerShell.NetCore.psd1 -WarningAction Stop
. Assumption is that the Deployment
folder is created during the build process. However, this path also appears to be incorrect since it is (or could be) relative to test folder and could be present at root level.EDIT: Looks like the include paths are coded in a way so that tests are executed from tests
directory.
Hi @bcdady,
Good afternoon.
Based on my analysis on Windows and Mac, looks like the include paths are coded in a way so that tests are executed from tests
directory. Kindly note that Deployment
folder should have the necessary module AWSPowerShell.NetCore
which is outcome of build output. Please try executing Invoke-Pester
command from within <<PowerShell_RepoFolder>>/tests
after successful build (using msbuild buildtools\build.proj
, you might be able to build only on Windows).
Thanks, Ashish
This issue has not recieved a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.
Most (all?) Pester test scripts (within ../test/) reference ../Include/TestIncludes.ps1. Invoking a Pester test against a *.Tests.ps1 script writes an error to the console. (e.g. ./tests/Discovery/Get-AWSService.Tests.ps1
(For example, this Issue references Get-AWSService.Tests.ps1, but arguably any other script in /tests/ should behave consistently). Invoking Pester should cause no PowerShell runtime errors; only output results of test scripts
Current Behavior
Invoking Pester displays
CommandNotFoundException
:Possible Solution
Steps to Reproduce
From within a local copy of this repo, and with the Pester module installed/imported:
Context
I discovered this issue while trying to validate modifications to
Get-AWSService.Tests.ps1
.Here is a view showing all the Pester test scripts that expect to load this 'module': TestIncludes.ps1
Environment Detected while using AWS Tools for PowerShell version 4.0.2.0 on macOS ("Darwin 19.2.0"), with PowerShell Core version 7 RC1.