Cleanup logic should remove not only the module built/tested but
also any dependent modules. Not doing so can result in failures
when PS tries to load multiple instances of a module (eg when that
module exposes types).
test.depend.psd1 defines all dependencies of the SUT.
A new Unload-SUT function uses this to generically unload all
modules necessary.
Cleanup after all testcases
Is best practice that after a test run, to cleanup by removing SUT modules. This is achieved by adding an AfterAll code block
to each test file
Cleanup module.build.ps1
Now that loading/unloading is handled by each test, the
ImportModule task is no longer necessarily
New
Unload-SUT
functionCleanup logic should remove not only the module built/tested but also any dependent modules. Not doing so can result in failures when PS tries to load multiple instances of a module (eg when that module exposes types).
test.depend.psd1
defines all dependencies of the SUT. A newUnload-SUT
function uses this to generically unload all modules necessary.Cleanup after all testcases
Is best practice that after a test run, to cleanup by removing SUT modules. This is achieved by adding an
AfterAll
code block to each test fileCleanup module.build.ps1
Now that loading/unloading is handled by each test, the ImportModule task is no longer necessarily