diff --git a/internal/app/table_tests.go b/internal/app/table_tests.go index 4eb7a0f..383be04 100644 --- a/internal/app/table_tests.go +++ b/internal/app/table_tests.go @@ -41,6 +41,8 @@ type packageTests struct { skipped []*parse.Test passedCount int passed []*parse.Test + failed []*parse.Test + failedCount int } func (c *consoleWriter) testsTable(packages []*parse.Package, option TestTableOptions) { @@ -77,9 +79,10 @@ func (c *consoleWriter) testsTable(packages []*parse.Package, option TestTableOp continue } pkgTests := getTestsFromPackages(pkg, option) - all := make([]*parse.Test, 0, len(pkgTests.passed)+len(pkgTests.skipped)) + all := make([]*parse.Test, 0, len(pkgTests.passed)+len(pkgTests.skipped)+len(pkgTests.failed)) all = append(all, pkgTests.passed...) all = append(all, pkgTests.skipped...) + all = append(all, pkgTests.failed...) for _, t := range all { // TODO(mf): why are we sorting this? @@ -145,9 +148,10 @@ func (c *consoleWriter) testsTableMarkdown(packages []*parse.Package, option Tes continue } pkgTests := getTestsFromPackages(pkg, option) - all := make([]*parse.Test, 0, len(pkgTests.passed)+len(pkgTests.skipped)) + all := make([]*parse.Test, 0, len(pkgTests.passed)+len(pkgTests.skipped)+len(pkgTests.failed)) all = append(all, pkgTests.passed...) all = append(all, pkgTests.skipped...) + all = append(all, pkgTests.failed...) for _, t := range all { // TODO(mf): why are we sorting this? @@ -174,9 +178,10 @@ func (c *consoleWriter) testsTableMarkdown(packages []*parse.Package, option Tes fmt.Fprintf(c.w, "## 📦 Package **`%s`**\n", pkg.Summary.Package) fmt.Fprintln(c.w) - msg := fmt.Sprintf("Tests: ✓ %d passed | %d skipped\n", + msg := fmt.Sprintf("Tests: ✓ %d passed | %d skipped | %d failed\n", pkgTests.passedCount, pkgTests.skippedCount, + pkgTests.failedCount, ) if option.Slow > 0 && option.Slow < pkgTests.passedCount { msg += fmt.Sprintf("↓ Slowest %d passed tests shown (of %d)\n", @@ -205,6 +210,8 @@ func getTestsFromPackages(pkg *parse.Package, option TestTableOptions) *packageT tests.skippedCount = len(skipped) passed := pkg.TestsByAction(parse.ActionPass) tests.passedCount = len(passed) + failed := pkg.TestsByAction(parse.ActionFail) + tests.failedCount = len(failed) if option.Skip { tests.skipped = append(tests.skipped, skipped...) } @@ -219,6 +226,7 @@ func getTestsFromPackages(pkg *parse.Package, option TestTableOptions) *packageT tests.passed = tests.passed[:option.Slow] } } + tests.failed = append(tests.failed, failed...) return tests } diff --git a/tests/failed_test.go b/tests/failed_test.go new file mode 100644 index 0000000..5ca8651 --- /dev/null +++ b/tests/failed_test.go @@ -0,0 +1,56 @@ +package parsetest + +import ( + "bytes" + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/mfridman/tparse/internal/app" + "github.com/mfridman/tparse/parse" +) + +func TestFailedTestsTable(t *testing.T) { + t.Parallel() + + base := filepath.Join("testdata", "failed") + + tt := []struct { + fileName string + exitCode int + }{ + {"test_01", 1}, + {"test_02", 1}, + {"test_03", 1}, + {"test_04", 1}, + } + + for _, tc := range tt { + t.Run(tc.fileName, func(t *testing.T) { + buf := bytes.NewBuffer(nil) + inputFile := filepath.Join(base, tc.fileName+".jsonl") + options := app.Options{ + FileName: inputFile, + Output: buf, + Sorter: parse.SortByPackageName, + TestTableOptions: app.TestTableOptions{ + Pass: true, // Enable test table output + Skip: true, // Also show skipped tests + }, + } + gotExitCode, err := app.Run(options) + require.NoError(t, err) + assert.Equal(t, tc.exitCode, gotExitCode) + + goldenFile := filepath.Join(base, tc.fileName+".golden") + want, err := os.ReadFile(goldenFile) + if err != nil { + t.Fatal(err) + } + checkGolden(t, inputFile, goldenFile, buf.Bytes(), want) + }) + } +} diff --git a/tests/testdata/failed/test_01.golden b/tests/testdata/failed/test_01.golden new file mode 100644 index 0000000..492d684 --- /dev/null +++ b/tests/testdata/failed/test_01.golden @@ -0,0 +1,132 @@ +╭────────┬─────────┬───────────────────────────────────────┬───────────────────────────────────────╮ +│ Status │ Elapsed │ Test │ Package │ +├────────┼─────────┼───────────────────────────────────────┼───────────────────────────────────────┤ +│ PASS │ 5.45 │ TestMigrateUpWithReset │ github.com/pressly/goose/v3/tests/e2e │ +│ PASS │ 5.39 │ TestMigrateUpTo │ github.com/pressly/goose/v3/tests/e2e │ +│ PASS │ 4.96 │ TestMigrateUpByOne │ github.com/pressly/goose/v3/tests/e2e │ +│ PASS │ 3.37 │ TestMigrateFull │ github.com/pressly/goose/v3/tests/e2e │ +│ PASS │ 2.53 │ TestMigrateUpWithRedo │ github.com/pressly/goose/v3/tests/e2e │ +│ PASS │ 2.32 │ TestNoVersioning │ github.com/pressly/goose/v3/tests/e2e │ +│ PASS │ 0.02 │ TestNoVersioning/seed-up-down-to-zero │ github.com/pressly/goose/v3/tests/e2e │ +│ PASS │ 0.02 │ TestNoVersioning/test-seed-up-reset │ github.com/pressly/goose/v3/tests/e2e │ +│ PASS │ 0.01 │ TestNoVersioning/test-seed-up-redo │ github.com/pressly/goose/v3/tests/e2e │ +│ FAIL │ 3.71 │ TestNotAllowMissing │ github.com/pressly/goose/v3/tests/e2e │ +│ FAIL │ 2.55 │ TestAllowMissingUpWithRedo │ github.com/pressly/goose/v3/tests/e2e │ +│ FAIL │ 3.16 │ TestNowAllowMissingUpByOne │ github.com/pressly/goose/v3/tests/e2e │ +│ FAIL │ 4.13 │ TestAllowMissingUpWithReset │ github.com/pressly/goose/v3/tests/e2e │ +│ FAIL │ 3.15 │ TestAllowMissingUpByOne │ github.com/pressly/goose/v3/tests/e2e │ +│ FAIL │ 5.11 │ TestMigrateAllowMissingDown │ github.com/pressly/goose/v3/tests/e2e │ +╰────────┴─────────┴───────────────────────────────────────┴───────────────────────────────────────╯ +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ FAIL package: github.com/pressly/goose/v3/tests/e2e ┃ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + +--- FAIL: TestAllowMissingUpByOne (3.15s) + + allow_missing_test.go:329: unexpected number value: got:0 want:1 +2022/05/19 22:03:07 OK 00001_a.sql +2022/05/19 22:03:07 OK 00002_b.sql +2022/05/19 22:03:07 OK 00003_c.sql +2022/05/19 22:03:07 OK 00004_d.sql +2022/05/19 22:03:07 OK 00005_e.sql +2022/05/19 22:03:07 OK 00006_f.sql +2022/05/19 22:03:07 OK 00007_g.sql +2022/05/19 22:03:07 OK 00008_h.sql +2022/05/19 22:03:07 OK 00009_i.sql +2022/05/19 22:03:07 OK 00010_j.sql +2022/05/19 22:03:07 OK 00011_k.sql +2022/05/19 22:03:07 goose: no migrations to run. current version: 11 +2022/05/19 22:03:07 OK 00011_k.sql +2022/05/19 22:03:07 OK 00010_j.sql + +──────────────────────────────────────────────────────────────────────────────────────────────── + +--- FAIL: TestAllowMissingUpWithRedo (2.55s) + + allow_missing_test.go:329: unexpected number value: got:0 want:1 + +──────────────────────────────────────────────────────────────────────────────────────────────── + +--- FAIL: TestAllowMissingUpWithReset (4.13s) + + allow_missing_test.go:329: unexpected number value: got:0 want:1 +2022/05/19 22:03:08 OK 00001_a.sql +2022/05/19 22:03:08 OK 00002_b.sql +2022/05/19 22:03:08 OK 00003_c.sql +2022/05/19 22:03:08 OK 00004_d.sql +2022/05/19 22:03:08 OK 00005_e.sql +2022/05/19 22:03:08 OK 00006_f.sql +2022/05/19 22:03:08 OK 00007_g.sql +2022/05/19 22:03:08 OK 00008_h.sql +2022/05/19 22:03:08 OK 00009_i.sql +2022/05/19 22:03:08 OK 00010_j.sql +2022/05/19 22:03:08 OK 00011_k.sql +2022/05/19 22:03:08 goose: no migrations to run. current version: 11 + +──────────────────────────────────────────────────────────────────────────────────────────────── + +--- FAIL: TestMigrateAllowMissingDown (5.11s) + + allow_missing_test.go:329: unexpected number value: got:0 want:1 +2022/05/19 22:03:09 OK 00005_e.sql +2022/05/19 22:03:09 OK 00006_f.sql +2022/05/19 22:03:09 OK 00007_g.sql +2022/05/19 22:03:09 OK 00008_h.sql +2022/05/19 22:03:09 OK 00009_i.sql +2022/05/19 22:03:09 OK 00010_j.sql +2022/05/19 22:03:09 OK 00001_a.sql +2022/05/19 22:03:09 OK 00001_a.sql +2022/05/19 22:03:09 OK 00011_k.sql +2022/05/19 22:03:09 goose: no migrations to run. current version: 11 +2022/05/19 22:03:09 OK 00001_a.sql +2022/05/19 22:03:09 OK 00011_k.sql +2022/05/19 22:03:09 OK 00002_b.sql +2022/05/19 22:03:09 OK 00010_j.sql +2022/05/19 22:03:09 OK 00009_i.sql +2022/05/19 22:03:09 OK 00002_b.sql +2022/05/19 22:03:09 OK 00008_h.sql +2022/05/19 22:03:09 OK 00001_a.sql +2022/05/19 22:03:09 OK 00002_b.sql +2022/05/19 22:03:09 OK 00003_c.sql +2022/05/19 22:03:09 OK 00007_g.sql +2022/05/19 22:03:09 OK 00002_b.sql +2022/05/19 22:03:09 goose: no migrations to run. current version: 2 +2022/05/19 22:03:09 OK 00006_f.sql +2022/05/19 22:03:09 OK 00003_c.sql +2022/05/19 22:03:09 OK 00005_e.sql +2022/05/19 22:03:09 OK 00003_c.sql +2022/05/19 22:03:09 OK 00004_d.sql +2022/05/19 22:03:09 OK 00004_d.sql +2022/05/19 22:03:09 OK 00003_c.sql +2022/05/19 22:03:09 OK 00004_d.sql +2022/05/19 22:03:09 OK 00002_b.sql +2022/05/19 22:03:09 OK 00004_d.sql +2022/05/19 22:03:09 OK 00001_a.sql +2022/05/19 22:03:09 OK 00005_e.sql +2022/05/19 22:03:09 OK 00005_e.sql +2022/05/19 22:03:09 OK 00005_e.sql +2022/05/19 22:03:09 OK 00006_f.sql +2022/05/19 22:03:09 OK 00006_f.sql +2022/05/19 22:03:09 OK 00006_f.sql +2022/05/19 22:03:09 OK 00007_g.sql +2022/05/19 22:03:09 OK 00007_g.sql +2022/05/19 22:03:09 OK 00007_g.sql +2022/05/19 22:03:09 OK 00008_h.sql + +──────────────────────────────────────────────────────────────────────────────────────────────── + +--- FAIL: TestNotAllowMissing (3.71s) + + allow_missing_test.go:329: unexpected number value: got:0 want:1 + +──────────────────────────────────────────────────────────────────────────────────────────────── + +--- FAIL: TestNowAllowMissingUpByOne (3.16s) + + allow_missing_test.go:329: unexpected number value: got:0 want:1 + +╭────────┬─────────┬───────────────────────────────────────┬───────┬──────┬──────┬──────╮ +│ Status │ Elapsed │ Package │ Cover │ Pass │ Fail │ Skip │ +├────────┼─────────┼───────────────────────────────────────┼───────┼──────┼──────┼──────┤ +│ FAIL │ 9.00s │ github.com/pressly/goose/v3/tests/e2e │ -- │ 9 │ 6 │ 0 │ +╰────────┴─────────┴───────────────────────────────────────┴───────┴──────┴──────┴──────╯ diff --git a/tests/testdata/failed/test_02.golden b/tests/testdata/failed/test_02.golden new file mode 100644 index 0000000..0a02622 --- /dev/null +++ b/tests/testdata/failed/test_02.golden @@ -0,0 +1,28 @@ +╭────────┬─────────┬──────────────┬──────────────────────────────────────╮ +│ Status │ Elapsed │ Test │ Package │ +├────────┼─────────┼──────────────┼──────────────────────────────────────┤ +│ FAIL │ 1.00 │ TestWhatever │ github.com/mfridman/debug-go/testing │ +╰────────┴─────────┴──────────────┴──────────────────────────────────────╯ +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ FAIL package: github.com/mfridman/debug-go/testing ┃ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + +--- FAIL: TestWhatever (1.00s) + + main_test.go:13: assert error + main_test.go:14: + Error Trace: main_test.go:14 + Error: "does not contain" does not contain "ostriche" + Test: TestWhatever + main_test.go:15: + Error Trace: main_test.go:15 + Error: Received unexpected error: + make the errorss.. + Test: TestWhatever + main_test.go:17: skdhjfg + +╭────────┬─────────┬──────────────────────────────────────┬───────┬──────┬──────┬──────╮ +│ Status │ Elapsed │ Package │ Cover │ Pass │ Fail │ Skip │ +├────────┼─────────┼──────────────────────────────────────┼───────┼──────┼──────┼──────┤ +│ FAIL │ 1.11s │ github.com/mfridman/debug-go/testing │ -- │ 0 │ 1 │ 0 │ +╰────────┴─────────┴──────────────────────────────────────┴───────┴──────┴──────┴──────╯ diff --git a/tests/testdata/failed/test_03.golden b/tests/testdata/failed/test_03.golden new file mode 100644 index 0000000..b2ae692 --- /dev/null +++ b/tests/testdata/failed/test_03.golden @@ -0,0 +1,137 @@ +╭────────┬─────────┬─────────────────────────────────┬──────────────────────────────────╮ +│ Status │ Elapsed │ Test │ Package │ +├────────┼─────────┼─────────────────────────────────┼──────────────────────────────────┤ +│ PASS │ 0.02 │ TestMetrics │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.01 │ TestBigOutcome │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.01 │ TestPackageCache │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.01 │ TestPackageCover │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNewEvent │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCachedEvent │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCoverEvent │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestFiles │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestsToRun │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestsWarn │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestActionString │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestElapsed │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPanic │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestSingleTestFailStack │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestBigOutcome/input01.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPanic/input01.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPanic/input02.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPanic/input03.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPanic/input04.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPanic/input05.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestFiles/event_0 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestFiles/event_1 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestSingleTestFailStack/input01 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPrescan/input01.txt │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPrescan/input04.txt │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestFiles/event_2 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestsToRun/event_0 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestBigOutcome/input02.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestSingleTestFailStack/input02 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestFiles/event_3 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCachedEvent/event_0 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCachedEvent/event_1 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCachedEvent/event_2 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCachedEvent/event_3 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestsWarn/event_0 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestSingleTestFailStack/input03 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCachedEvent/event_4 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestsToRun/event_1 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestsToRun/event_2 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestsWarn/event_1 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestsToRun/event_3 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestSingleTestFailStack/input04 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCoverEvent/event_0 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestsWarn/event_2 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCoverEvent/event_1 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNoTestsWarn/event_3 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCoverEvent/event_2 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCoverEvent/event_3 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestBigOutcome/input03.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCoverEvent/event_4 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNewEvent/event_0 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestCoverEvent/event_5 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNewEvent/event_1 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNewEvent/event_2 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestSingleTestFailStack/input05 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNewEvent/event_3 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNewEvent/event_4 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNewEvent/event_5 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNewEvent/event_6 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNewEvent/event_7 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNewEvent/event_8 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestNewEvent/event_9 │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestBigOutcome/input04.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestBigOutcome/input05.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestBigOutcome/input06.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestBigOutcome/input07.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestBigOutcome/input08.json │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPackageCover/log │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPackageCover/bytes │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPackageCover/sort │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPackageCache/mime │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPackageCache/time │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPackageCache/strings │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestPackageCache/fmt │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestMetrics/fmt_test │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestMetrics/strings_test │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestMetrics/bytes_test │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestMetrics/bufio_test │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestMetrics/crypto_test │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestMetrics/log_test │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestMetrics/mime_test │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestMetrics/sort_test │ github.com/mfridman/tparse/parse │ +│ PASS │ 0.00 │ TestMetrics/time_test │ github.com/mfridman/tparse/parse │ +│ FAIL │ 0.00 │ TestPrescan │ github.com/mfridman/tparse/parse │ +│ FAIL │ 0.00 │ TestRaceReplay │ github.com/mfridman/tparse/parse │ +│ FAIL │ 0.00 │ TestRaceReplay/input01 │ github.com/mfridman/tparse/parse │ +│ FAIL │ 0.00 │ TestRaceReplay/input02 │ github.com/mfridman/tparse/parse │ +│ FAIL │ 0.00 │ TestRaceReplay/input03 │ github.com/mfridman/tparse/parse │ +│ FAIL │ 0.00 │ TestPrescan/input02.txt │ github.com/mfridman/tparse/parse │ +│ FAIL │ 0.00 │ TestPrescan/input03.txt │ github.com/mfridman/tparse/parse │ +│ │ │ │ │ +│ PASS │ 0.00 │ TestFollow │ github.com/mfridman/tparse/tests │ +│ PASS │ 0.00 │ TestFollow/test_01 │ github.com/mfridman/tparse/tests │ +│ PASS │ 0.00 │ TestFollow/test_02 │ github.com/mfridman/tparse/tests │ +│ PASS │ 0.00 │ TestFollow/test_03 │ github.com/mfridman/tparse/tests │ +│ PASS │ 0.00 │ TestFollow/test_04 │ github.com/mfridman/tparse/tests │ +│ PASS │ 0.00 │ TestFollow/test_05 │ github.com/mfridman/tparse/tests │ +╰────────┴─────────┴─────────────────────────────────┴──────────────────────────────────╯ +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ FAIL package: github.com/mfridman/tparse/parse ┃ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + +--- FAIL: TestPrescan (0.00s) + --- FAIL: TestPrescan/input02.txt (0.00s) + + prescan_test.go:51: want failure after reading >50 lines of non-parsable events: got err type *fmt.wrapError want *errors.fundamental: line 51 json error: invalid character 'p' looking for beginning of value: failed to parse + + --- FAIL: TestPrescan/input03.txt (0.00s) + + prescan_test.go:51: want failure when stream contains a bad event(s) -> good event(s) -> bad event: got err type *fmt.wrapError want *errors.fundamental: line 6 json error: invalid character 'r' looking for beginning of value: failed to parse + +──────────────────────────────────────────────────────────────────────────────────────────────── + +--- FAIL: TestRaceReplay (0.00s) + --- FAIL: TestRaceReplay/input01 (0.00s) + + race_test.go:56: got wrong opaque error %!q(); want ErrRaceDetected + + --- FAIL: TestRaceReplay/input02 (0.00s) + + race_test.go:41: race input does not match expected output; diff files in race dir suffixed with .FAIL to debug + race_test.go:42: diff parse/testdata/race/input02.json.FAIL parse/testdata/race/output02.golden.FAIL + race_test.go:56: got wrong opaque error %!q(); want ErrRaceDetected + + --- FAIL: TestRaceReplay/input03 (0.00s) + + race_test.go:56: got wrong opaque error %!q(); want ErrRaceDetected + +╭────────┬─────────┬──────────────────────────────────┬───────┬──────┬──────┬──────╮ +│ Status │ Elapsed │ Package │ Cover │ Pass │ Fail │ Skip │ +├────────┼─────────┼──────────────────────────────────┼───────┼──────┼──────┼──────┤ +│ FAIL │ 0.17s │ github.com/mfridman/tparse/parse │ -- │ 83 │ 7 │ 0 │ +│ PASS │ 0.10s │ github.com/mfridman/tparse/tests │ -- │ 6 │ 0 │ 0 │ +╰────────┴─────────┴──────────────────────────────────┴───────┴──────┴──────┴──────╯ diff --git a/tests/testdata/failed/test_04.golden b/tests/testdata/failed/test_04.golden new file mode 100644 index 0000000..43bd5bb --- /dev/null +++ b/tests/testdata/failed/test_04.golden @@ -0,0 +1,51 @@ +╭────────┬─────────┬────────────────────────────────┬────────────────────────╮ +│ Status │ Elapsed │ Test │ Package │ +├────────┼─────────┼────────────────────────────────┼────────────────────────┤ +│ FAIL │ 1.00 │ TestWhatever │ command-line-arguments │ +│ FAIL │ 0.00 │ TestWhatever/foo │ command-line-arguments │ +│ FAIL │ 0.00 │ TestWhatever/foo/bar │ command-line-arguments │ +│ FAIL │ 0.00 │ TestWhatever/foo/baz │ command-line-arguments │ +│ FAIL │ 0.00 │ TestWhatever/foo/bar/inner-bar │ command-line-arguments │ +│ FAIL │ 0.00 │ TestWhatever/foo/baz/inner-baz │ command-line-arguments │ +╰────────┴─────────┴────────────────────────────────┴────────────────────────╯ +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ FAIL package: command-line-arguments ┃ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + +--- FAIL: TestWhatever (1.00s) + + main_test.go:12: assert error + main_test.go:13: + Error Trace: main_test.go:13 + Error: "does not contain" does not contain "ostriche" + Test: TestWhatever + main_test.go:35: + Error Trace: main_test.go:35 + Error: Not equal: + expected: 7823456 + actual : 1 + Test: TestWhatever + Messages: not what I was expecting + + --- FAIL: TestWhatever/foo (0.00s) + + main_test.go:17: some random output from foo only + + --- FAIL: TestWhatever/foo/bar (0.00s) + + main_test.go:20: some random output from bar only + + --- FAIL: TestWhatever/foo/bar/inner-bar (0.00s) + + main_test.go:23: another inner-bar + + --- FAIL: TestWhatever/foo/baz (0.00s) + --- FAIL: TestWhatever/foo/baz/inner-baz (0.00s) + + main_test.go:30: some inner-baz error + +╭────────┬─────────┬────────────────────────┬───────┬──────┬──────┬──────╮ +│ Status │ Elapsed │ Package │ Cover │ Pass │ Fail │ Skip │ +├────────┼─────────┼────────────────────────┼───────┼──────┼──────┼──────┤ +│ FAIL │ 1.13s │ command-line-arguments │ -- │ 0 │ 6 │ 0 │ +╰────────┴─────────┴────────────────────────┴───────┴──────┴──────┴──────╯