Skip to content

test: add module-level Pester tests for Import-Module - #140

Merged
mikemadeja merged 1 commit into
developfrom
test/module-import
Oct 7, 2026
Merged

mikemadeja merged 1 commit into
developfrom
test/module-import

Conversation

@mikemadeja

Copy link
Copy Markdown
Owner

Summary

  • Adds tests/PiHoleShell.Module.Tests.ps1, a non-integration unit test suite (no live Pi-hole server required) covering Import-Module and the module's export list
  • Checks: import succeeds without error; at least one function is exported; no duplicate names in the export list; every exported name resolves to a real, loadable command; every Public/ function (except ones marked #INTERNAL FUNCTION or #Work In Progress) is actually exported; every exported name has a matching function definition somewhere under Public/ or Private/
  • This catches exactly the kind of mistake that's easy to make across ~75 functions and 20+ feature PRs: a typo in PiHoleShell.psm1's Export-ModuleMember list, a new function that was never added to it, or a stale export left behind after a rename/delete

Test plan

  • All 6 tests pass against the real module
  • Validated the tests actually catch breakage: deliberately introduced a typo in the DHCP export entry, confirmed the relevant test failed with a clear message, then reverted it
  • PSScriptAnalyzer clean
  • Full non-integration unit suite passes (18/18)

🤖 Generated with Claude Code

Verifies importing PiHoleShell.psm1 succeeds, and that the module's
export list stays consistent with what's actually defined under
Public/Private - catches typos in the Export-ModuleMember list (a
name with no backing function), a new Public function that forgot to
be added to it, and a stale export left behind after a rename/delete.
Validated by deliberately introducing a typo and confirming the
relevant test fails before reverting it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mikemadeja
mikemadeja merged commit aa0e577 into develop Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant