Skip to content

tests: prevent repo file modifications during test runs #38

Closed as not planned

Description

@blindzero

Problem Statement

During test execution (Invoke-Pester), some tests currently generate or modify files inside the repository working tree (e.g. documentation or reference artifacts).

This leads to several issues:

  • git status becomes dirty after running tests
  • developers are prompted to commit changes they did not intend to make
  • CI and local test behavior diverges
  • unit tests have side effects outside their execution scope

--> Tests must be side-effect free with regard to the repository state.

Proposed Solution

  • Ensure that running tests never modifies committed files
  • Clearly distinguish between:
    • fixtures (static, committed test data)
    • generated artifacts (temporary test output)
  • Improve test isolation and developer experience
  • Keep CI and local test runs fully deterministic

Scope / Planned Changes

  1. Test Output Redirection
  • All generator or writer logic invoked from tests must write to $TestDrive
  • No test may write to:
    • docs/
    • references/
    • repo root
    • any committed path
  1. Fixtures vs. Generated Files
  • Static test inputs and expected outputs must be moved to: tests/fixtures/
  • Tests read fixtures via Get-Content, Import-*, etc.
  • Fixtures are committed and reviewed like normal source files
  1. Generator Tests (“Golden Master” Pattern)
  • Documentation / reference generators:
    • generate output into $TestDrive
    • compare generated output against committed reference files
  • Tests must not regenerate committed documentation in-place
  1. Optional Safety Net (if applicable)
  • Generator code may support a configurable output location via:
    • -OutputPathparameter and/or
    • environment variable override (e.g. IDLE_OUTPUT_DIR)
  • Tests must always set this to $TestDrive
  1. Cleanup
  • Ensure no temporary artifacts remain after test execution
  • Invoke-Pester must leave git status clean

Out of Scope

  • No functional changes to IdLE engine logic
  • No changes to step behavior or provider contracts
  • No documentation regeneration as part of this issue

Acceptance Criteria / Definition of Done

  • Running Invoke-Pester does not modify the working tree
  • git status is clean after a test run
  • All generated files during tests are written to $TestDrive
  • Fixtures are clearly separated under tests/fixtures
  • CI (Windows + Linux) passes without repo modifications
  • No test relies on implicit filesystem side effects

Notes

This issue focuses on test hygiene and developer experience only and must be implemented as a standalone PR, separate from functional or feature-related changes.

Activity

  1. self-assigned this
    on Dec 31, 2025
  2. changed the title [-][Feature] tests: prevent repo file modifications during test runs[/-] [+]tests: prevent repo file modifications during test runs[/+] on Jan 1, 2026
  3. blindzero commented on Jan 2, 2026

    @blindzero
    OwnerAuthor

    in the meantime clean, all tests with "Set-Content" use "Testdrive" and dont create files in repo anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementprio:mediumtype:tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions