Skip to content

Tests - restructure folders and split helpers by domain (single entry point)#117

Merged
blindzero merged 5 commits intomainfrom
copilot/restructure-tests-folder-helpers
Jan 26, 2026
Merged

Tests - restructure folders and split helpers by domain (single entry point)#117
blindzero merged 5 commits intomainfrom
copilot/restructure-tests-folder-helpers

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 25, 2026

Summary

Reorganized tests/ into domain-specific folders and split _testHelpers.ps1 into domain helper files while maintaining a single stable entry point for all tests.

Motivation

The flat tests/ structure had grown to 29+ files at the root level, making navigation difficult. Helper functions were centralized in one file regardless of domain. This restructure improves discoverability and maintainability without changing test behavior.

Type of Change

  • Refactoring / internal improvement
  • Documentation update

Changes

Folder structure

  • Created domain folders: Core/, Steps/, Packaging/, Examples/
  • Moved 34 test files to appropriate domains (18 Core, 6 Steps, 4 Packaging, 1 Examples, 5 Providers already existed)
  • All test files remain *.Tests.ps1 and Pester-discoverable

Helper split (single entry point preserved)

  • Created tests/Steps/_testHelpers.Steps.ps1 - moved New-IdleTestStepMetadata from global helper
  • Created tests/Providers/_testHelpers.Providers.ps1 - empty, ready for provider test infrastructure
  • Updated tests/_testHelpers.ps1 to dot-source domain helpers at top
  • Added missing IdLE.Steps.Mailbox module import to test helpers
  • Tests continue dot-sourcing only tests/_testHelpers.ps1 (single entry point maintained)

Path updates and fixes

  • Updated 29 moved test files to reference parent directory: Join-Path (Split-Path -Path $PSScriptRoot -Parent) '_testHelpers.ps1'
  • Fixed relative paths in 8 test files after folder restructure (changed ../ to ../../ for moved files)
  • Updated fixtures paths in Core tests to account for new directory structure
  • Fixed module import paths in Invoke-IdleStepAuthSession.Tests.ps1
  • Uses $PSScriptRoot for robust relative path resolution

Documentation

  • Updated docs/advanced/testing.md with new test folder structure section
  • Documented domain-organized folders, test helper organization, and fixture locations
  • Added guidance for contributors on where to place new tests

Testing

  • Unit tests

How to test & review

All 333 tests pass with 0 failures and 3 skipped. PSScriptAnalyzer passes with no blocking errors (9 pre-existing informational warnings unrelated to this change). The restructuring maintains full test coverage while improving organization.

Checklist

  • Code follows STYLEGUIDE.md
  • Tests added or updated
  • Documentation updated
  • No UI/auth logic added to IdLE.Core
  • No breaking changes without discussion

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Create domain folders: Core/, Steps/, Packaging/, Examples/
- Move test files to appropriate domain folders
- Create domain helper files:
  - Steps/_testHelpers.Steps.ps1 (contains New-IdleTestStepMetadata)
  - Providers/_testHelpers.Providers.ps1 (empty, ready for future use)
- Update main _testHelpers.ps1 to dot-source domain helpers
- Update all test file paths to use parent directory for helpers
- All tests remain discoverable by Pester
- PSScriptAnalyzer passes with no issues

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Copilot AI changed the title [WIP] Restructure tests folder and split helpers by domain Tests - restructure folders and split helpers by domain (single entry point) Jan 25, 2026
Copilot AI requested a review from blindzero January 25, 2026 21:34
@blindzero
Copy link
Copy Markdown
Owner

@copilot Pester tests are red

Copilot AI and others added 2 commits January 26, 2026 06:47
- Add missing IdLE.Steps.Mailbox module import to test helpers
- Fix relative paths in Invoke-IdleStepAuthSession.Tests.ps1 (BeforeAll imports)
- Fix relative paths in CapabilityDeprecation.Tests.ps1 (examples/workflows references)
- Fix relative paths in ModuleSurface.Tests.ps1 (repoRoot calculation)
- Tests now at 287 passed / 46 failed (was 247 passed / 87 failed)

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
- Fix fixtures paths in New-IdlePlan.Capabilities.Tests.ps1
- Fix fixtures paths in Export-IdlePlan.Tests.ps1
- Fix fixtures paths in Resolve-IdleStepMetadataCatalog.Tests.ps1
- Fix fixtures paths in Resolve-IdleWorkflowTemplates.Tests.ps1
- All tests now passing: 333 passed, 0 failed, 3 skipped
- PSScriptAnalyzer passes with no issues

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot Pester tests are red

Fixed in commits 80e144f and b89a730. The test failures were caused by:

  1. Missing IdLE.Steps.Mailbox module import in test helpers
  2. Incorrect relative paths after moving test files to subdirectories (needed ../../ instead of ../)
  3. Fixtures path references not updated for the new folder structure

All 333 tests now pass with 0 failures. ✅

blindzero

This comment was marked as outdated.

Copy link
Copy Markdown
Owner

@blindzero blindzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

  • is PSSA also "green" (no warnings)?
  • do we still have to adjust the documentation on testing regarding the new tests structure?

Add section describing the domain-organized test folder structure:
- Core/, Steps/, Providers/, Packaging/, Examples/ folders
- Test helper organization with single entry point
- Fixture location

This helps contributors understand where to place new tests.

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot

  • is PSSA also "green" (no warnings)?
  • do we still have to adjust the documentation on testing regarding the new tests structure?

PSSA status: ✅ Green (no blocking errors). There are 9 informational warnings about indentation in New-IdlePlanObject.ps1, but these are pre-existing and unrelated to the test restructure. PSSA only fails on errors (FailOnSeverity: Error), so CI passes.

Documentation: ✅ Updated in commit 39999ba. Added a "Test folder structure" section to docs/advanced/testing.md that documents:

  • The domain-organized folders (Core/, Steps/, Providers/, Packaging/, Examples/)
  • Test helper organization with single entry point
  • Fixture location and naming conventions

This helps contributors understand where to place new tests.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.powershellgallery.com
    • Triggering command: /usr/bin/pwsh pwsh -NoProfile -File ./tools/Invoke-IdleScriptAnalyzer.ps1 -CI (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@blindzero blindzero marked this pull request as ready for review January 26, 2026 19:06
Copilot AI review requested due to automatic review settings January 26, 2026 19:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reorganizes the test folder structure from a flat 29+ file layout into domain-specific folders, improving discoverability and maintainability. The helper functions are split by domain while maintaining a single stable entry point for all tests.

Changes:

  • Restructured tests into domain-specific folders (Core, Steps, Providers, Packaging, Examples)
  • Split test helper functions by domain with single entry point pattern
  • Updated all test file paths to reference parent directory helper
  • Added IdLE.Steps.Mailbox module import to shared test infrastructure
  • Updated documentation to reflect new test organization

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/_testHelpers.ps1 Dot-sources domain helpers at top; adds Mailbox module import; removes moved function
tests/Steps/_testHelpers.Steps.ps1 New step-specific helper file containing New-IdleTestStepMetadata function
tests/Providers/_testHelpers.Providers.ps1 New empty provider-specific helper file as extension point
tests/Steps/*.Tests.ps1 (6 files) Updated to reference parent directory helper using Split-Path pattern
tests/Packaging/*.Tests.ps1 (4 files) Updated helper references and repo root calculation for new location
tests/Examples/WorkflowSamples.Tests.ps1 Updated helper reference for new location
tests/Core/*.Tests.ps1 (18 files) Updated helper references and fixture paths for subdirectory structure
docs/advanced/testing.md Documented new folder structure and helper organization

@blindzero blindzero linked an issue Jan 26, 2026 that may be closed by this pull request
19 tasks
@blindzero blindzero merged commit 9f26a04 into main Jan 26, 2026
11 checks passed
@blindzero blindzero deleted the copilot/restructure-tests-folder-helpers branch January 31, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests - restructure folders and split helpers by domain (single entry point)

3 participants