testing story (e.g. mock shell environments)

Open
#5 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
go
Domain
cli

Research direction

Start by reviewing the existing command and output APIs referenced by the issue, especially Output instances and the shell.Run/run.Cmd flow. Define the testing approach and decide whether outputtest mocks or a command-runner abstraction best fits before implementing and validating mock shell execution.

Written by the indexing model from the issue text.

Description

Some ideas:

  1. encourage scripts to accept Output instances, provide outputtest package for building simple mocks
  2. provide a "command factory" analogous to Buildkite's Shell, e.g. shell.Cmd() - this factory could be an interface that facilitates mocking. Alternatively, it could be shell.Run(Runner), where *Command implements Runner (now that I think of it, I like the latter):
    out := shell.Run(run.Cmd(ctx, "foobar")) // shell can mock execution and output, or propagate shared env
    

cc @jhchabran

Dominant language
Go
Stars
41
Forks
3
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sourcegraph/run

All issues in sourcegraph/run

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.