Skip to content

Docs: Clarify Stage.mount() method signature and behavior #64

@kluth

Description

@kluth

Problem

Stage.mount() documentation shows both class and instance usage but doesn't clarify which is correct or the differences.

Affected Files

Documentation: /home/matthias/projects/synapse/docs/testing/TESTING_GUIDE.md (lines 54-55, 149)

Issue Details

Severity: LOW
Impact: Can infer from context but not explicit

Ambiguous Examples

stage.mount('my-component', MyComponent);        // Passes class
stage.mount('user-service', new UserService());  // Passes instance

Unclear Aspects

  1. Does mount accept both classes and instances?
  2. If it accepts both, what are the differences?
  3. What's the lifecycle of mounted components?
  4. When should you use class vs instance?
  5. Does mount instantiate the class automatically?

Recommended Enhancement

Add clarification:

// Option 1: Mount class (Stage will instantiate)
stage.mount('my-component', MyComponent);

// Option 2: Mount instance (use existing instance)
stage.mount('user-service', new UserService(config));

// Differences:
// - Class: Stage manages lifecycle, can create multiple instances
// - Instance: You manage lifecycle, shared singleton

Priority

LOW - Documentation polish for clarity

References

User Story

As a developer using the Theater testing system, I want clear mount() documentation, so that I understand when to pass classes vs instances and the lifecycle implications.

Acceptance Criteria

  • Document that both classes and instances are accepted
  • Explain lifecycle differences
  • Provide usage recommendations
  • Add examples of each approach
  • Document instantiation behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or requestlowLow priority - backlog

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions