The way in which you’ve structured makeExporGraph is a wonderful
example of how taking data dependencies rather than directly depending
on global values can make your code easily testable in a natural way
that does not require writing any mocks.
You are testing a pure function that operates on two interfaces: the
IAnalysisAdapter interface and the Stdio interface. At test time,
you provide a Stdio implementation that captures its output into
memory, and an IAnalysisAdapter implementation that has some fixed
success or failure behavior. At runtime, the Stdio interface is