@@ -41,6 +41,8 @@ type packageTests struct {
4141 skipped []* parse.Test
4242 passedCount int
4343 passed []* parse.Test
44+ failed []* parse.Test
45+ failedCount int
4446}
4547
4648func (c * consoleWriter ) testsTable (packages []* parse.Package , option TestTableOptions ) {
@@ -77,9 +79,10 @@ func (c *consoleWriter) testsTable(packages []*parse.Package, option TestTableOp
7779 continue
7880 }
7981 pkgTests := getTestsFromPackages (pkg , option )
80- all := make ([]* parse.Test , 0 , len (pkgTests .passed )+ len (pkgTests .skipped ))
82+ all := make ([]* parse.Test , 0 , len (pkgTests .passed )+ len (pkgTests .skipped )+ len ( pkgTests . failed ) )
8183 all = append (all , pkgTests .passed ... )
8284 all = append (all , pkgTests .skipped ... )
85+ all = append (all , pkgTests .failed ... )
8386
8487 for _ , t := range all {
8588 // TODO(mf): why are we sorting this?
@@ -145,9 +148,10 @@ func (c *consoleWriter) testsTableMarkdown(packages []*parse.Package, option Tes
145148 continue
146149 }
147150 pkgTests := getTestsFromPackages (pkg , option )
148- all := make ([]* parse.Test , 0 , len (pkgTests .passed )+ len (pkgTests .skipped ))
151+ all := make ([]* parse.Test , 0 , len (pkgTests .passed )+ len (pkgTests .skipped )+ len ( pkgTests . failed ) )
149152 all = append (all , pkgTests .passed ... )
150153 all = append (all , pkgTests .skipped ... )
154+ all = append (all , pkgTests .failed ... )
151155
152156 for _ , t := range all {
153157 // TODO(mf): why are we sorting this?
@@ -174,9 +178,10 @@ func (c *consoleWriter) testsTableMarkdown(packages []*parse.Package, option Tes
174178 fmt .Fprintf (c .w , "## 📦 Package **`%s`**\n " , pkg .Summary .Package )
175179 fmt .Fprintln (c .w )
176180
177- msg := fmt .Sprintf ("Tests: ✓ %d passed | %d skipped\n " ,
181+ msg := fmt .Sprintf ("Tests: ✓ %d passed | %d skipped | %d failed \n " ,
178182 pkgTests .passedCount ,
179183 pkgTests .skippedCount ,
184+ pkgTests .failedCount ,
180185 )
181186 if option .Slow > 0 && option .Slow < pkgTests .passedCount {
182187 msg += fmt .Sprintf ("↓ Slowest %d passed tests shown (of %d)\n " ,
@@ -205,6 +210,8 @@ func getTestsFromPackages(pkg *parse.Package, option TestTableOptions) *packageT
205210 tests .skippedCount = len (skipped )
206211 passed := pkg .TestsByAction (parse .ActionPass )
207212 tests .passedCount = len (passed )
213+ failed := pkg .TestsByAction (parse .ActionFail )
214+ tests .failedCount = len (failed )
208215 if option .Skip {
209216 tests .skipped = append (tests .skipped , skipped ... )
210217 }
@@ -219,6 +226,7 @@ func getTestsFromPackages(pkg *parse.Package, option TestTableOptions) *packageT
219226 tests .passed = tests .passed [:option .Slow ]
220227 }
221228 }
229+ tests .failed = append (tests .failed , failed ... )
222230 return tests
223231}
224232
0 commit comments