Skip to content

Conversation

@galligan
Copy link
Contributor

@galligan galligan commented Jan 23, 2026

Add fixture helpers for test environments:

  • createTempDir(): Isolated temp directory with cleanup
  • createMockLogger(): In-memory logger for assertions
  • createTestConfig(): Config with fixtures directory
  • createWorkspace(): Full workspace with temp files
  • Comprehensive test coverage

Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

Contributes to #47

Copy link
Contributor Author

galligan commented Jan 23, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@greptile-apps
Copy link

greptile-apps bot commented Jan 23, 2026

Greptile Summary

  • Adds new @outfitter/testing package with fixture utilities for isolated test environments including temp directory management, mock loggers, and file loading
  • Implements comprehensive TypeScript configuration and package.json with modular exports for fixtures, CLI harness, and MCP harness modules
  • Provides deep object cloning/merging utilities with proper cleanup handling and environment variable isolation for test scenarios

Important Files Changed

Filename Overview
packages/testing/src/fixtures.ts New file providing core testing utilities; includes temp directory management, environment isolation, and fixture loading with automatic cleanup
packages/testing/package.json New package configuration with comprehensive exports structure for testing harnesses; requires review of export paths alignment with actual implementation

Confidence score: 4/5

  • This PR is safe to merge with minor concerns about export path alignment
  • Score reflects solid implementation patterns but potential mismatch between declared exports and current file structure - package.json declares exports for cli-harness and mcp-harness modules that don't exist yet
  • Pay close attention to packages/testing/package.json exports configuration to ensure all declared paths will be implemented

Sequence Diagram

sequenceDiagram
    participant User
    participant FixtureFactory as "Fixture Factory"
    participant TempDir as "Temp Directory"
    participant EnvManager as "Environment Manager"
    participant FileSystem as "File System"

    User->>FixtureFactory: "createFixture(defaults)"
    FixtureFactory->>FixtureFactory: "deepClone(defaults)"
    FixtureFactory-->>User: "factory function"

    User->>FixtureFactory: "factory(overrides)"
    FixtureFactory->>FixtureFactory: "deepMerge(cloned, overrides)"
    FixtureFactory-->>User: "merged fixture"

    User->>TempDir: "withTempDir(fn)"
    TempDir->>FileSystem: "mkdir(tempPath)"
    FileSystem-->>TempDir: "directory created"
    TempDir->>User: "fn(tempPath)"
    User-->>TempDir: "result"
    TempDir->>FileSystem: "rm(tempPath, recursive)"
    TempDir-->>User: "result"

    User->>EnvManager: "withEnv(vars, fn)"
    EnvManager->>EnvManager: "store original env"
    EnvManager->>EnvManager: "set new env vars"
    EnvManager->>User: "fn()"
    User-->>EnvManager: "result"
    EnvManager->>EnvManager: "restore original env"
    EnvManager-->>User: "result"

    User->>FileSystem: "loadFixture(name)"
    FileSystem->>FileSystem: "readFileSync(filePath)"
    FileSystem->>FileSystem: "parse if JSON"
    FileSystem-->>User: "fixture data"
Loading

@galligan galligan changed the base branch from p3-16/mcp/server-impl to graphite-base/79 January 23, 2026 21:40
@galligan galligan force-pushed the p3-17/testing/fixtures branch from 4d06f54 to a33da83 Compare January 23, 2026 21:46
@galligan galligan changed the base branch from graphite-base/79 to p3-16/mcp/server-impl January 23, 2026 21:46
@galligan
Copy link
Contributor Author

Reviewed Greptile note: package exports now only include the fixtures entrypoint and the root index re-exports fixtures, so exports align with the current file set in this PR.

@galligan
Copy link
Contributor Author

Fixed @outfitter/testing exports so the root entrypoint exists at this layer, and added fixtures tests to satisfy package test runs. Restacked and submitted the update with gt.

@galligan galligan force-pushed the p3-17/testing/fixtures branch from a33da83 to cddc577 Compare January 23, 2026 23:09
@galligan galligan force-pushed the p3-16/mcp/server-impl branch from d24df4b to bd9332b Compare January 23, 2026 23:09
@galligan
Copy link
Contributor Author

Restacked after downstack update (formatRelative test stabilization); no additional changes in this PR.

@galligan galligan changed the base branch from p3-16/mcp/server-impl to graphite-base/79 January 24, 2026 02:57
@galligan galligan force-pushed the p3-17/testing/fixtures branch from cddc577 to ac76953 Compare January 24, 2026 02:58
@galligan galligan changed the base branch from graphite-base/79 to p3-16/mcp/server-impl January 24, 2026 02:58
@galligan
Copy link
Contributor Author

Confirmed @outfitter/testing now ships src/index.ts (root export) and only exports ./fixtures; missing harness subpaths are no longer advertised. Resubmitted after restack.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants