I have a module lets call it root. Within the psd1 file i have a number of nested modules defined. I am trying to perform my unit tests using team city. I am copying all of the required modules to a local directory where I perform the tests. The problem is that the nested modules are not found when importing the root module as the local directory is not in PSModulePath. This is really by design, so if any one can tell me how to mock a module in the tested module node of the manifest to point at a relative location to the root module that would be great.
You should be able to simple define a relative path in the NestedModules section of the .psd1 file, such as DependentModules\Module1\Module.psm1. Or you could import the module in code by the Import-Module cmdlet and use $PSScriptRoot to determine the path where your module resides. And then you can get to your module path either by using the standard *-Path cmdlets, such as Split-Path, or using the standand Windows relative path notation $PSScriptRoot\..\..\Modules.