fixes an issue with random seed env var
Этот коммит содержится в:
родитель
edf592e2b9
коммит
92660751ca
4 изменённых файлов: 11 добавлений и 16 удалений
2
fmt.go
2
fmt.go
|
@ -321,6 +321,7 @@ func (f *basefmt) Summary() {
|
|||
}
|
||||
}
|
||||
}
|
||||
passed = total - undefined
|
||||
var owner interface{}
|
||||
for _, undef := range f.undefined {
|
||||
if owner != undef.owner {
|
||||
|
@ -328,7 +329,6 @@ func (f *basefmt) Summary() {
|
|||
owner = undef.owner
|
||||
}
|
||||
}
|
||||
passed = total - undefined
|
||||
|
||||
var steps, parts, scenarios []string
|
||||
nsteps := len(f.passed) + len(f.failed) + len(f.skipped) + len(f.undefined) + len(f.pending)
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -54,8 +53,6 @@ func TestProgressFormatterOutput(t *testing.T) {
|
|||
23 steps (14 passed, 2 failed, 2 pending, 3 undefined, 2 skipped)
|
||||
%s
|
||||
|
||||
Randomized with seed: %s
|
||||
|
||||
You can implement step definitions for undefined steps with these snippets:
|
||||
|
||||
func undefined() error {
|
||||
|
@ -72,7 +69,7 @@ func FeatureContext(s *godog.Suite) {
|
|||
}`
|
||||
|
||||
var zeroDuration time.Duration
|
||||
expected = fmt.Sprintf(expected, zeroDuration.String(), os.Getenv("GODOG_SEED"))
|
||||
expected = fmt.Sprintf(expected, zeroDuration.String())
|
||||
expected = trimAllLines(expected)
|
||||
|
||||
r.run()
|
||||
|
@ -120,7 +117,7 @@ func TestProgressFormatterWhenStepPanics(t *testing.T) {
|
|||
}
|
||||
|
||||
out := buf.String()
|
||||
if idx := strings.Index(out, "github.com/DATA-DOG/godog/fmt_progress_test.go:114"); idx == -1 {
|
||||
if idx := strings.Index(out, "github.com/DATA-DOG/godog/fmt_progress_test.go:111"); idx == -1 {
|
||||
t.Fatalf("expected to find panic stacktrace, actual:\n%s", out)
|
||||
}
|
||||
}
|
||||
|
@ -188,13 +185,11 @@ Error: sub2: sub-sub: errored
|
|||
1 scenarios (1 failed)
|
||||
2 steps (1 passed, 1 failed)
|
||||
%s
|
||||
|
||||
Randomized with seed: %s
|
||||
`
|
||||
|
||||
expected = trimAllLines(expected)
|
||||
var zeroDuration time.Duration
|
||||
expected = fmt.Sprintf(expected, zeroDuration.String(), os.Getenv("GODOG_SEED"))
|
||||
expected = fmt.Sprintf(expected, zeroDuration.String())
|
||||
actual := trimAllLines(buf.String())
|
||||
|
||||
shouldMatchOutput(expected, actual, t)
|
||||
|
@ -283,8 +278,6 @@ func TestProgressFormatterMultistepTemplates(t *testing.T) {
|
|||
2 steps (1 passed, 1 undefined)
|
||||
%s
|
||||
|
||||
Randomized with seed: %s
|
||||
|
||||
You can implement step definitions for undefined steps with these snippets:
|
||||
|
||||
func undef() error {
|
||||
|
@ -307,7 +300,7 @@ func FeatureContext(s *godog.Suite) {
|
|||
`
|
||||
|
||||
var zeroDuration time.Duration
|
||||
expected = fmt.Sprintf(expected, zeroDuration.String(), os.Getenv("GODOG_SEED"))
|
||||
expected = fmt.Sprintf(expected, zeroDuration.String())
|
||||
expected = trimAllLines(expected)
|
||||
|
||||
actual := trimAllLines(buf.String())
|
||||
|
@ -396,12 +389,10 @@ Feature: basic
|
|||
1 scenarios (1 failed)
|
||||
2 steps (1 passed, 1 failed)
|
||||
%s
|
||||
|
||||
Randomized with seed: %s
|
||||
`
|
||||
|
||||
var zeroDuration time.Duration
|
||||
expected = fmt.Sprintf(expected, zeroDuration.String(), os.Getenv("GODOG_SEED"))
|
||||
expected = fmt.Sprintf(expected, zeroDuration.String())
|
||||
expected = trimAllLines(expected)
|
||||
|
||||
actual := trimAllLines(buf.String())
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
feature
|
||||
|
||||
<bold-white>Scenario:</bold-white> one step passing <black># formatter-tests/features/single_scenario_with_passing_step.feature:6</black>
|
||||
<green>Given</green> <green>a passing step</green> <black># formatters_print_test.go:35 -> github.com/DATA-DOG/godog.TestPrintingFormatters.func4</black>
|
||||
<green>Given</green> <green>a passing step</green> <black># formatters_print_test.go:34 -> github.com/DATA-DOG/godog.TestPrintingFormatters.func4</black>
|
||||
|
||||
1 scenarios (<green>1 passed</green>)
|
||||
1 steps (<green>1 passed</green>)
|
||||
|
|
4
run.go
4
run.go
|
@ -166,6 +166,10 @@ func RunWithOptions(suite string, contextInitializer func(suite *Suite), opt Opt
|
|||
} else {
|
||||
failed = r.run()
|
||||
}
|
||||
|
||||
// @TODO: should prevent from having these
|
||||
os.Setenv("GODOG_SEED", "")
|
||||
os.Setenv("GODOG_TESTED_PACKAGE", "")
|
||||
if failed && opt.Format != "events" {
|
||||
return exitFailure
|
||||
}
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче