Merge pull request #404 from vearutop/gofmt

Fix tests and CircleCI jobs
Этот коммит содержится в:
Viacheslav Poturaev 2021-07-09 16:18:16 +02:00 коммит произвёл GitHub
родитель 7cadaeffdb 885805bfd3
коммит 9a335aed22
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 39 добавлений и 18 удалений

Просмотреть файл

@ -77,7 +77,7 @@ jobs:
steps:
- all
go1_16:
working_directory: /go/src/github.com/cucumber/godog
working_directory: /home/circleci/go/src/github.com/cucumber/godog
executor: exec_go_1_16
steps:
- all

Просмотреть файл

@ -21,7 +21,7 @@ type customFmt struct {
}
func (f *customFmt) TestRunStarted() {}
func (f *customFmt) Feature(*messages.GherkinDocument, string, []byte) {}
func (f *customFmt) Feature(*messages.GherkinDocument, string, []byte) {}
func (f *customFmt) Pickle(*godog.Scenario) {}
func (f *customFmt) Defined(*godog.Scenario, *godog.Step, *godog.StepDefinition) {}
func (f *customFmt) Passed(*godog.Scenario, *godog.Step, *godog.StepDefinition) {}

Просмотреть файл

@ -3,6 +3,10 @@ module custom-formatter
go 1.14
require (
github.com/cucumber/godog v0.11.0
github.com/cucumber/gherkin-go/v11 v11.0.0 // indirect
github.com/cucumber/godog v0.10.1-0.20210705192606-df8c6e49b40b
github.com/cucumber/messages-go/v10 v10.0.3 // indirect
github.com/cucumber/messages-go/v16 v16.0.1
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-memdb v1.3.2 // indirect
)

Просмотреть файл

@ -35,11 +35,18 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cucumber/gherkin-go/v11 v11.0.0 h1:cwVwN1Qn2VRSfHZNLEh5x00tPBmZcjATBWDpxsR5Xug=
github.com/cucumber/gherkin-go/v11 v11.0.0/go.mod h1:CX33k2XU2qog4e+TFjOValoq6mIUq0DmVccZs238R9w=
github.com/cucumber/gherkin-go/v19 v19.0.3 h1:mMSKu1077ffLbTJULUfM5HPokgeBcIGboyeNUof1MdE=
github.com/cucumber/gherkin-go/v19 v19.0.3/go.mod h1:jY/NP6jUtRSArQQJ5h1FXOUgk5fZK24qtE7vKi776Vw=
github.com/cucumber/godog v0.10.1-0.20210705192606-df8c6e49b40b h1:TthfOM7c3wz2M5kUvktCU27WXufvUSV/YtcxQk2yaq8=
github.com/cucumber/godog v0.10.1-0.20210705192606-df8c6e49b40b/go.mod h1:ql2U1OH5nlLZ2UDD/3fDJ1+0vkib0XGgEn8NYXCwDZQ=
github.com/cucumber/godog v0.11.0 h1:xgaWyJuAD6A+aW4TfVGNDBhuMyKW0jjl0cvY3KNxEak=
github.com/cucumber/godog v0.11.0/go.mod h1:GyxCIrsg1sgEgpL2GD/rMr3fIoNHpgkjm9nANw/89XY=
github.com/cucumber/messages-go/v10 v10.0.1/go.mod h1:kA5T38CBlBbYLU12TIrJ4fk4wSkVVOgyh7Enyy8WnSg=
github.com/cucumber/messages-go/v10 v10.0.3 h1:m/9SD/K/A15WP7i1aemIv7cwvUw+viS51Ui5HBw1cdE=
github.com/cucumber/messages-go/v10 v10.0.3/go.mod h1:9jMZ2Y8ZxjLY6TG2+x344nt5rXstVVDYSdS5ySfI1WY=
github.com/cucumber/messages-go/v16 v10.0.1/go.mod h1:kA5T38CBlBbYLU12TIrJ4fk4wSkVVOgyh7Enyy8WnSg=
github.com/cucumber/messages-go/v16 v10.0.3 h1:m/9SD/K/A15WP7i1aemIv7cwvUw+viS51Ui5HBw1cdE=
github.com/cucumber/messages-go/v16 v10.0.3/go.mod h1:9jMZ2Y8ZxjLY6TG2+x344nt5rXstVVDYSdS5ySfI1WY=
github.com/cucumber/messages-go/v16 v16.0.0/go.mod h1:EJcyR5Mm5ZuDsKJnT2N9KRnBK30BGjtYotDKpwQ0v6g=
github.com/cucumber/messages-go/v16 v16.0.1 h1:fvkpwsLgnIm0qugftrw2YwNlio+ABe2Iu94Ap8GMYIY=
github.com/cucumber/messages-go/v16 v16.0.1/go.mod h1:EJcyR5Mm5ZuDsKJnT2N9KRnBK30BGjtYotDKpwQ0v6g=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -93,8 +100,12 @@ github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.0 h1:8exGP7ego3OmkfksihtSouGMZ+hQrhxx+FVELeXpVPE=
github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-memdb v1.3.0 h1:xdXq34gBOMEloa9rlGStLxmfX/dyIK8htOv36dQUwHU=
github.com/hashicorp/go-memdb v1.3.0/go.mod h1:Mluclgwib3R93Hk5fxEfiRhB+6Dar64wWh71LpNSe3g=
github.com/hashicorp/go-memdb v1.3.2 h1:RBKHOsnSszpU6vxq80LzC2BaQjuuvoyaQbkLTf7V7g8=
github.com/hashicorp/go-memdb v1.3.2/go.mod h1:Mluclgwib3R93Hk5fxEfiRhB+6Dar64wWh71LpNSe3g=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=

2
go.mod
Просмотреть файл

@ -1,6 +1,6 @@
module github.com/cucumber/godog
go 1.16
go 1.13
require (
github.com/cucumber/gherkin-go/v19 v19.0.3

Просмотреть файл

@ -127,6 +127,10 @@ func Build(bin string) error {
// we also print back the temp WORK directory
// go has built. We will reuse it for our suite workdir.
temp := fmt.Sprintf(filepath.Join("%s", "temp-%d.test"), os.TempDir(), time.Now().UnixNano())
modTidyOutput, err := exec.Command("go", "mod", "tidy").CombinedOutput()
if err != nil {
return fmt.Errorf("failed to tidy modules in tested package: %s, reason: %v, output: %s", abs, err, string(modTidyOutput))
}
testOutput, err := exec.Command("go", "test", "-c", "-work", "-o", temp).CombinedOutput()
if err != nil {
return fmt.Errorf("failed to compile tested package: %s, reason: %v, output: %s", abs, err, string(testOutput))

Просмотреть файл

@ -27,8 +27,6 @@ func Test_GodogBuild(t *testing.T) {
t.Run("WithVendoredGodogAndMod", testWithVendoredGodogAndMod)
t.Run("WithModule", func(t *testing.T) {
t.Parallel()
t.Run("OutsideGopathAndHavingOnlyFeature", testOutsideGopathAndHavingOnlyFeature)
t.Run("OutsideGopath", testOutsideGopath)
t.Run("OutsideGopathWithXTest", testOutsideGopathWithXTest)
@ -302,8 +300,6 @@ type builderTestCase struct {
}
func (bt builderTestCase) run(t *testing.T) {
t.Parallel()
err := buildTestPackage(bt.dir, bt.files)
defer os.RemoveAll(bt.dir)
require.Nil(t, err)

Просмотреть файл

@ -5,7 +5,7 @@ import (
"github.com/cucumber/godog/formatters"
"github.com/cucumber/godog/internal/storage"
"github.com/cucumber/messages-go/v10"
"github.com/cucumber/messages-go/v16"
)
// MultiFormatter passes test progress to multiple formatters.
@ -57,42 +57,42 @@ func (r repeater) Pickle(pickle *messages.Pickle) {
}
// Defined triggers Defined for all added formatters.
func (r repeater) Defined(pickle *messages.Pickle, step *messages.Pickle_PickleStep, definition *formatters.StepDefinition) {
func (r repeater) Defined(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
for _, f := range r {
f.Defined(pickle, step, definition)
}
}
// Failed triggers Failed for all added formatters.
func (r repeater) Failed(pickle *messages.Pickle, step *messages.Pickle_PickleStep, definition *formatters.StepDefinition, err error) {
func (r repeater) Failed(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition, err error) {
for _, f := range r {
f.Failed(pickle, step, definition, err)
}
}
// Passed triggers Passed for all added formatters.
func (r repeater) Passed(pickle *messages.Pickle, step *messages.Pickle_PickleStep, definition *formatters.StepDefinition) {
func (r repeater) Passed(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
for _, f := range r {
f.Passed(pickle, step, definition)
}
}
// Skipped triggers Skipped for all added formatters.
func (r repeater) Skipped(pickle *messages.Pickle, step *messages.Pickle_PickleStep, definition *formatters.StepDefinition) {
func (r repeater) Skipped(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
for _, f := range r {
f.Skipped(pickle, step, definition)
}
}
// Undefined triggers Undefined for all added formatters.
func (r repeater) Undefined(pickle *messages.Pickle, step *messages.Pickle_PickleStep, definition *formatters.StepDefinition) {
func (r repeater) Undefined(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
for _, f := range r {
f.Undefined(pickle, step, definition)
}
}
// Pending triggers Pending for all added formatters.
func (r repeater) Pending(pickle *messages.Pickle, step *messages.Pickle_PickleStep, definition *formatters.StepDefinition) {
func (r repeater) Pending(pickle *messages.Pickle, step *messages.PickleStep, definition *formatters.StepDefinition) {
for _, f := range r {
f.Pending(pickle, step, definition)
}

Просмотреть файл

@ -38,7 +38,7 @@ func (f Feature) FindBackground(astScenarioID string) *messages.Background {
}
}
return bg
return nil
}
// FindExample ...

Просмотреть файл

@ -350,7 +350,13 @@ func Test_FormatOutputRun(t *testing.T) {
noRandomFlag, []string{featurePath},
)
file := filepath.Join(t.TempDir(), "result.xml")
dir := filepath.Join(os.TempDir(), t.Name())
err := os.MkdirAll(dir, 0755)
require.NoError(t, err)
defer os.RemoveAll(dir)
file := filepath.Join(dir, "result.xml")
actualStatus, actualOutput := testRun(t,
fmtOutputScenarioInitializer,