You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: runner_test.go
    path of file: ./repos/chainlink/tools/flakeytests
    
    the code of the file until where you have to start completion: package flakeytests

import (
	"context"
	"io"
	"os"
	"os/exec"
	"strings"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"

	"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
)

type mockReporter struct {
	report *Report
}

func (m *mockReporter) Report(_ context.Context, report *Report) error {
	m.report = report
	return nil
}

func newMockReporter() *mockReporter {
	return &mockReporter{report: NewReport()}
}

func TestParser(t *testing.T) {
	output := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}
`

	r := strings.NewReader(output)
	pr, err := parseOutput(r)
	require.
    
func TestRunner_WithFlake(t *testing.T) {
	initialOutput := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}`
	outputs := []string{
		`{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}`,
		``,
	}
	m := newMockReporter()
	i := 0
	r := &Runner{
		numReruns: 2,
		readers:   []io.Reader{strings.NewReader(initialOutput)},

		testCommand: testAdapter(func(pkg string, testNames []string, w io.Writer) error {
			_, err := w.Write([]byte(outputs[i]))
			i++
			return err
		}),
		parse:    parseOutput,
		reporter: m,
	}

	// This will report a flake since we've mocked the rerun
	// to only report one failure (not two as expected).
	err := r.Run(tests.Context(t))
	require.NoError(t, err)
	assert.Len(t, m.report.tests, 1)
	_, ok := m.report.tests["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"]["TestLink"]
	assert.True(t, ok)
}