Skip to content

Add integration tests for run command #1

@mgoldsborough

Description

@mgoldsborough

Summary

The run command has unit tests for utility functions (parsePackageSpec, getCacheDir, resolveArgs), but lacks integration tests for the main handleRun function and error handling paths.

Current Test Coverage

  • parsePackageSpec - parsing @scope/name@version specs
  • getCacheDir - cache directory path generation
  • resolveArgs - ${__dirname} placeholder resolution

Proposed Tests

Test Value Effort Notes
Integration: handleRun with mock bundle High Medium Mock registry client, verify spawn args
--update flag forces re-download Medium Medium Verify cache is invalidated
PYTHONPATH env var set correctly Medium Low Verify deps/ is prepended
Error handling: missing manifest Medium Medium Should throw clear error
Error handling: network errors Medium Medium Graceful failure with message

Implementation Notes

  • Consider using vitest mocking for RegistryClient and spawn
  • Could create a test fixture .mcpb bundle for integration tests
  • Python PYTHONPATH test could verify env object without spawning

Files

  • src/commands/packages/run.ts - implementation
  • src/commands/packages/run.test.ts - existing unit tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions