Improve Pester test coverage for core modules

Open
#188 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
github-actions, powershell
Domain
ci-cd, testing

Research direction

Start by reviewing the existing Pester suite under the tests folder and inventorying the core modules and behaviors named in the issue. Then inspect the repository's GitHub workflow configuration, if present, to determine the reusable workflow entry point. Done means expanded mocked coverage, a baseline that increases incrementally, and validation that runs Pester and PSScriptAnalyzer across the supported PowerShell environments.

Written by the indexing model from the issue text.

Description

documentation enhancement impact-low priority-high status/In Progress

Is your feature request related to a problem? Please describe.
Monkey365 already includes a Pester test suite under the tests folder, but unit test coverage for the core internal modules is still limited.

Running the project with Set-StrictMode -Version Latest helps catch some issues during execution, but it does not replace automated unit tests, static analysis, or pull request validation.

Describe the solution you'd like

Expand the Pester test suite to cover the main internal components, including:

  • Runspace creation, execution, cleanup, and error handling
  • API request construction, pagination, retries, and failure scenarios
  • Authentication and token-handling workflows
  • Configuration file loading, validation, and default values
  • Shared functions and other core module behavior

External services should be mocked where possible so the tests remain reliable and can run without access to an Azure or Microsoft 365 tenant.

Add a reusable workflow that:

  • Runs Pester and PSScriptAnalyzer for pull requests and commits
  • Publishes test results and code coverage
  • Fails when tests or static analysis checks fail
  • Supports Windows PowerShell and PowerShell Core where applicable
  • Can be reused by other Monkey365 repositories

An initial code coverage baseline should be established and increased incrementally as more modules are covered.

Improved test coverage and pull request validation will help catch regressions earlier, make refactoring safer, validate edge cases, and provide clearer documentation of the expected behavior of internal functions.

Related issues

  • #153
  • #181
Dominant language
PowerShell
Stars
1.3k
Forks
140
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from silverhack/monkey365

All issues in silverhack/monkey365

Similar issues

More DevOps issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.