Skip to content

Commit

Permalink
Support for labels and pending decorator in ginkgo outline output (#1113
Browse files Browse the repository at this point in the history
)

* ginkgo outline will now display a Labels column/field with
   labels assigned to nodes

 * proper support for the pending decorator assigned to nodes

 * documentation update

 * update to outline tests
  • Loading branch information
Dannyb48 authored Jan 5, 2023
1 parent b0bd77b commit e6e3b98
Show file tree
Hide file tree
Showing 28 changed files with 345 additions and 129 deletions.
17 changes: 9 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5093,14 +5093,14 @@ ginkgo outline book_test.go
This generates an outline in a comma-separated-values (CSV) format. Column headers are on the first line, followed by Ginkgo containers, specs, and other identifiers, in the order they appear in the file:
Name,Text,Start,End,Spec,Focused,Pending
Describe,Book,124,973,false,false,false
BeforeEach,,217,507,false,false,false
Describe,Categorizing book length,513,970,false,false,false
Context,With more than 300 pages,567,753,false,false,false
It,should be a novel,624,742,true,false,false
Context,With fewer than 300 pages,763,963,false,false,false
It,should be a short story,821,952,true,false,false
Name,Text,Start,End,Spec,Focused,Pending,Labels
Describe,Book,124,973,false,false,false,""
BeforeEach,,217,507,false,false,false,""
Describe,Categorizing book length,513,970,false,false,false,""
Context,With more than 300 pages,567,753,false,false,false,""
It,should be a novel,624,742,true,false,false,""
Context,With fewer than 300 pages,763,963,false,false,false,""
It,should be a short story,821,952,true,false,false,""
The columns are:
Expand All @@ -5111,6 +5111,7 @@ The columns are:
- Spec (bool): True, if the identifier is a spec.
- Focused (bool): True, if focused. (Conforms to the rules in [Focused Specs](#focused-specs).)
- Pending (bool): True, if pending. (Conforms to the rules in [Pending Specs](#pending-specs).)
- Labels (string): If labels are assigned to nodes then will be shown as double quoted comma separated values. (Conforms to the rules in [Spec Labels](#spec-labels).)
You can set a different output format with the `-format` flag. Accepted formats are `csv`, `indent`, and `json`. The `ident` format is like `csv`, but uses indentation to show the nesting of containers and specs. Both the `csv` and `json` formats can be read by another program, e.g., an editor plugin that displays a tree view of Ginkgo tests in a file, or presents a menu for the user to quickly navigate to a container or spec.
Expand Down
32 changes: 16 additions & 16 deletions ginkgo/outline/_testdata/alias_test.go.csv
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Name,Text,Start,End,Spec,Focused,Pending
Describe,NodotFixture,81,670,false,false,false
Describe,normal,126,259,false,false,false
It,normal,166,255,true,false,false
By,normal,201,223,false,false,false
By,normal,227,249,false,false,false
Context,normal,262,342,false,false,false
It,normal,301,338,true,false,false
When,normal,345,422,false,false,false
It,normal,381,418,true,false,false
It,normal,425,461,true,false,false
Specify,normal,464,505,true,false,false
DescribeTable,normal,508,586,false,false,false
Entry,normal,557,582,true,false,false
DescribeTable,normal,589,667,false,false,false
Entry,normal,638,663,true,false,false
Name,Text,Start,End,Spec,Focused,Pending,Labels
Describe,NodotFixture,81,670,false,false,false,""
Describe,normal,126,259,false,false,false,""
It,normal,166,255,true,false,false,""
By,normal,201,223,false,false,false,""
By,normal,227,249,false,false,false,""
Context,normal,262,342,false,false,false,""
It,normal,301,338,true,false,false,""
When,normal,345,422,false,false,false,""
It,normal,381,418,true,false,false,""
It,normal,425,461,true,false,false,""
Specify,normal,464,505,true,false,false,""
DescribeTable,normal,508,586,false,false,false,""
Entry,normal,557,582,true,false,false,""
DescribeTable,normal,589,667,false,false,false,""
Entry,normal,638,663,true,false,false,""
2 changes: 1 addition & 1 deletion ginkgo/outline/_testdata/alias_test.go.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"Describe","text":"NodotFixture","start":81,"end":670,"spec":false,"focused":false,"pending":false,"nodes":[{"name":"Describe","text":"normal","start":126,"end":259,"spec":false,"focused":false,"pending":false,"nodes":[{"name":"It","text":"normal","start":166,"end":255,"spec":true,"focused":false,"pending":false,"nodes":[{"name":"By","text":"normal","start":201,"end":223,"spec":false,"focused":false,"pending":false,"nodes":[]},{"name":"By","text":"normal","start":227,"end":249,"spec":false,"focused":false,"pending":false,"nodes":[]}]}]},{"name":"Context","text":"normal","start":262,"end":342,"spec":false,"focused":false,"pending":false,"nodes":[{"name":"It","text":"normal","start":301,"end":338,"spec":true,"focused":false,"pending":false,"nodes":[]}]},{"name":"When","text":"normal","start":345,"end":422,"spec":false,"focused":false,"pending":false,"nodes":[{"name":"It","text":"normal","start":381,"end":418,"spec":true,"focused":false,"pending":false,"nodes":[]}]},{"name":"It","text":"normal","start":425,"end":461,"spec":true,"focused":false,"pending":false,"nodes":[]},{"name":"Specify","text":"normal","start":464,"end":505,"spec":true,"focused":false,"pending":false,"nodes":[]},{"name":"DescribeTable","text":"normal","start":508,"end":586,"spec":false,"focused":false,"pending":false,"nodes":[{"name":"Entry","text":"normal","start":557,"end":582,"spec":true,"focused":false,"pending":false,"nodes":[]}]},{"name":"DescribeTable","text":"normal","start":589,"end":667,"spec":false,"focused":false,"pending":false,"nodes":[{"name":"Entry","text":"normal","start":638,"end":663,"spec":true,"focused":false,"pending":false,"nodes":[]}]}]}]
[{"name":"Describe","text":"NodotFixture","start":81,"end":670,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"Describe","text":"normal","start":126,"end":259,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"It","text":"normal","start":166,"end":255,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"By","text":"normal","start":201,"end":223,"spec":false,"focused":false,"pending":false,"labels":null,"nodes":[]},{"name":"By","text":"normal","start":227,"end":249,"spec":false,"focused":false,"pending":false,"labels":null,"nodes":[]}]}]},{"name":"Context","text":"normal","start":262,"end":342,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"It","text":"normal","start":301,"end":338,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[]}]},{"name":"When","text":"normal","start":345,"end":422,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"It","text":"normal","start":381,"end":418,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[]}]},{"name":"It","text":"normal","start":425,"end":461,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[]},{"name":"Specify","text":"normal","start":464,"end":505,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[]},{"name":"DescribeTable","text":"normal","start":508,"end":586,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"Entry","text":"normal","start":557,"end":582,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[]}]},{"name":"DescribeTable","text":"normal","start":589,"end":667,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"Entry","text":"normal","start":638,"end":663,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[]}]}]}]
12 changes: 6 additions & 6 deletions ginkgo/outline/_testdata/dsl_core_test.go.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name,Text,Start,End,Spec,Focused,Pending
Describe,DslCoreFixture,82,216,false,false,false
Describe,dslcore,119,213,false,false,false
It,dslcore,150,209,true,false,false
By,step 1,176,188,false,false,false
By,step 2,192,204,false,false,false
Name,Text,Start,End,Spec,Focused,Pending,Labels
Describe,DslCoreFixture,82,216,false,false,false,""
Describe,dslcore,119,213,false,false,false,""
It,dslcore,150,209,true,false,false,""
By,step 1,176,188,false,false,false,""
By,step 2,192,204,false,false,false,""
2 changes: 1 addition & 1 deletion ginkgo/outline/_testdata/dsl_core_test.go.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"Describe","text":"DslCoreFixture","start":82,"end":216,"spec":false,"focused":false,"pending":false,"nodes":[{"name":"Describe","text":"dslcore","start":119,"end":213,"spec":false,"focused":false,"pending":false,"nodes":[{"name":"It","text":"dslcore","start":150,"end":209,"spec":true,"focused":false,"pending":false,"nodes":[{"name":"By","text":"step 1","start":176,"end":188,"spec":false,"focused":false,"pending":false,"nodes":[]},{"name":"By","text":"step 2","start":192,"end":204,"spec":false,"focused":false,"pending":false,"nodes":[]}]}]}]}]
[{"name":"Describe","text":"DslCoreFixture","start":82,"end":216,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"Describe","text":"dslcore","start":119,"end":213,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"It","text":"dslcore","start":150,"end":209,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"By","text":"step 1","start":176,"end":188,"spec":false,"focused":false,"pending":false,"labels":null,"nodes":[]},{"name":"By","text":"step 2","start":192,"end":204,"spec":false,"focused":false,"pending":false,"labels":null,"nodes":[]}]}]}]}]
32 changes: 16 additions & 16 deletions ginkgo/outline/_testdata/focused_test.go.csv
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Name,Text,Start,End,Spec,Focused,Pending
Describe,unfocused,73,529,false,false,false
FDescribe,focused,105,202,false,true,false
It,focused,137,198,true,true,false
By,focused,163,176,false,true,false
By,focused,180,193,false,true,false
FContext,focused,205,268,false,true,false
It,focused,236,264,true,true,false
FWhen,focused,271,331,false,true,false
It,focused,299,327,true,true,false
FIt,focused,334,362,true,true,false
FSpecify,focused,365,398,true,true,false
FDescribeTable,focused,401,462,false,true,false
Entry,focused,442,458,true,true,false
DescribeTable,focused,465,526,false,false,false
FEntry,focused,505,522,true,true,false
Name,Text,Start,End,Spec,Focused,Pending,Labels
Describe,unfocused,73,529,false,false,false,""
FDescribe,focused,105,202,false,true,false,""
It,focused,137,198,true,true,false,""
By,focused,163,176,false,true,false,""
By,focused,180,193,false,true,false,""
FContext,focused,205,268,false,true,false,""
It,focused,236,264,true,true,false,""
FWhen,focused,271,331,false,true,false,""
It,focused,299,327,true,true,false,""
FIt,focused,334,362,true,true,false,""
FSpecify,focused,365,398,true,true,false,""
FDescribeTable,focused,401,462,false,true,false,""
Entry,focused,442,458,true,true,false,""
DescribeTable,focused,465,526,false,false,false,""
FEntry,focused,505,522,true,true,false,""
2 changes: 1 addition & 1 deletion ginkgo/outline/_testdata/focused_test.go.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"Describe","text":"unfocused","start":73,"end":529,"spec":false,"focused":false,"pending":false,"nodes":[{"name":"FDescribe","text":"focused","start":105,"end":202,"spec":false,"focused":true,"pending":false,"nodes":[{"name":"It","text":"focused","start":137,"end":198,"spec":true,"focused":true,"pending":false,"nodes":[{"name":"By","text":"focused","start":163,"end":176,"spec":false,"focused":true,"pending":false,"nodes":[]},{"name":"By","text":"focused","start":180,"end":193,"spec":false,"focused":true,"pending":false,"nodes":[]}]}]},{"name":"FContext","text":"focused","start":205,"end":268,"spec":false,"focused":true,"pending":false,"nodes":[{"name":"It","text":"focused","start":236,"end":264,"spec":true,"focused":true,"pending":false,"nodes":[]}]},{"name":"FWhen","text":"focused","start":271,"end":331,"spec":false,"focused":true,"pending":false,"nodes":[{"name":"It","text":"focused","start":299,"end":327,"spec":true,"focused":true,"pending":false,"nodes":[]}]},{"name":"FIt","text":"focused","start":334,"end":362,"spec":true,"focused":true,"pending":false,"nodes":[]},{"name":"FSpecify","text":"focused","start":365,"end":398,"spec":true,"focused":true,"pending":false,"nodes":[]},{"name":"FDescribeTable","text":"focused","start":401,"end":462,"spec":false,"focused":true,"pending":false,"nodes":[{"name":"Entry","text":"focused","start":442,"end":458,"spec":true,"focused":true,"pending":false,"nodes":[]}]},{"name":"DescribeTable","text":"focused","start":465,"end":526,"spec":false,"focused":false,"pending":false,"nodes":[{"name":"FEntry","text":"focused","start":505,"end":522,"spec":true,"focused":true,"pending":false,"nodes":[]}]}]}]
[{"name":"Describe","text":"unfocused","start":73,"end":529,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"FDescribe","text":"focused","start":105,"end":202,"spec":false,"focused":true,"pending":false,"labels":[],"nodes":[{"name":"It","text":"focused","start":137,"end":198,"spec":true,"focused":true,"pending":false,"labels":[],"nodes":[{"name":"By","text":"focused","start":163,"end":176,"spec":false,"focused":true,"pending":false,"labels":null,"nodes":[]},{"name":"By","text":"focused","start":180,"end":193,"spec":false,"focused":true,"pending":false,"labels":null,"nodes":[]}]}]},{"name":"FContext","text":"focused","start":205,"end":268,"spec":false,"focused":true,"pending":false,"labels":[],"nodes":[{"name":"It","text":"focused","start":236,"end":264,"spec":true,"focused":true,"pending":false,"labels":[],"nodes":[]}]},{"name":"FWhen","text":"focused","start":271,"end":331,"spec":false,"focused":true,"pending":false,"labels":[],"nodes":[{"name":"It","text":"focused","start":299,"end":327,"spec":true,"focused":true,"pending":false,"labels":[],"nodes":[]}]},{"name":"FIt","text":"focused","start":334,"end":362,"spec":true,"focused":true,"pending":false,"labels":[],"nodes":[]},{"name":"FSpecify","text":"focused","start":365,"end":398,"spec":true,"focused":true,"pending":false,"labels":[],"nodes":[]},{"name":"FDescribeTable","text":"focused","start":401,"end":462,"spec":false,"focused":true,"pending":false,"labels":[],"nodes":[{"name":"Entry","text":"focused","start":442,"end":458,"spec":true,"focused":true,"pending":false,"labels":[],"nodes":[]}]},{"name":"DescribeTable","text":"focused","start":465,"end":526,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"FEntry","text":"focused","start":505,"end":522,"spec":true,"focused":true,"pending":false,"labels":[],"nodes":[]}]}]}]
44 changes: 44 additions & 0 deletions ginkgo/outline/_testdata/labels_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package example_test

import (
. "github.com/onsi/ginkgo/v2"
)

var _ = Describe("NormalFixture", func() {
Describe("normal", Label("normal", "serial"), func() {
It("normal", func() {
By("step 1")
By("step 2")
})
})

Context("normal", func() {
It("normal", Label("medium"), Label("slow"), func() {

})
})

When("normal", func() {
It("normal", func() {

})
})

It("normal", func() {

})

Specify("normal", func() {

})

DescribeTable("normal",
func() {},
Entry("normal"),
)

DescribeTable("normal",
func() {},
Entry("normal"),
)
})
16 changes: 16 additions & 0 deletions ginkgo/outline/_testdata/labels_test.go.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Name,Text,Start,End,Spec,Focused,Pending,Labels
Describe,NormalFixture,73,571,false,false,false,""
Describe,normal,109,228,false,false,false,"normal, serial"
It,normal,166,224,true,false,false,""
By,step 1,191,203,false,false,false,""
By,step 2,207,219,false,false,false,""
Context,normal,231,323,false,false,false,""
It,normal,260,319,true,false,false,"medium, slow"
When,normal,326,383,false,false,false,""
It,normal,352,379,true,false,false,""
It,normal,386,412,true,false,false,""
Specify,normal,415,446,true,false,false,""
DescribeTable,normal,449,507,false,false,false,""
Entry,normal,488,503,true,false,false,""
DescribeTable,normal,510,568,false,false,false,""
Entry,normal,549,564,true,false,false,""
1 change: 1 addition & 0 deletions ginkgo/outline/_testdata/labels_test.go.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name":"Describe","text":"NormalFixture","start":73,"end":571,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"Describe","text":"normal","start":109,"end":228,"spec":false,"focused":false,"pending":false,"labels":["normal","serial"],"nodes":[{"name":"It","text":"normal","start":166,"end":224,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"By","text":"step 1","start":191,"end":203,"spec":false,"focused":false,"pending":false,"labels":null,"nodes":[]},{"name":"By","text":"step 2","start":207,"end":219,"spec":false,"focused":false,"pending":false,"labels":null,"nodes":[]}]}]},{"name":"Context","text":"normal","start":231,"end":323,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"It","text":"normal","start":260,"end":319,"spec":true,"focused":false,"pending":false,"labels":["medium","slow"],"nodes":[]}]},{"name":"When","text":"normal","start":326,"end":383,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"It","text":"normal","start":352,"end":379,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[]}]},{"name":"It","text":"normal","start":386,"end":412,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[]},{"name":"Specify","text":"normal","start":415,"end":446,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[]},{"name":"DescribeTable","text":"normal","start":449,"end":507,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"Entry","text":"normal","start":488,"end":503,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[]}]},{"name":"DescribeTable","text":"normal","start":510,"end":568,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"Entry","text":"normal","start":549,"end":564,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[]}]}]}]
36 changes: 18 additions & 18 deletions ginkgo/outline/_testdata/mixed_test.go.csv
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Name,Text,Start,End,Spec,Focused,Pending
FDescribe,unfocused,73,584,false,false,false
FContext,unfocused,106,205,false,false,false
It,unfocused,139,169,true,false,false
FIt,focused,172,201,true,true,false
Context,unfocused,208,306,false,false,false
FIt,focused,240,269,true,true,false
It,unfocused,272,302,true,false,false
FContext,focused,309,403,false,true,false
It,focused,340,368,true,true,false
It,focused,371,399,true,true,false
PContext,unfocused,406,581,false,false,true
FIt,unfocused,439,507,true,false,true
By,unfocused,468,483,false,false,true
By,unfocused,487,502,false,false,true
It,unfocused,510,577,true,false,true
By,unfocused,538,553,false,false,true
By,unfocused,557,572,false,false,true
Name,Text,Start,End,Spec,Focused,Pending,Labels
FDescribe,unfocused,73,584,false,false,false,""
FContext,unfocused,106,205,false,false,false,""
It,unfocused,139,169,true,false,false,""
FIt,focused,172,201,true,true,false,""
Context,unfocused,208,306,false,false,false,""
FIt,focused,240,269,true,true,false,""
It,unfocused,272,302,true,false,false,""
FContext,focused,309,403,false,true,false,""
It,focused,340,368,true,true,false,""
It,focused,371,399,true,true,false,""
PContext,unfocused,406,581,false,false,true,""
FIt,unfocused,439,507,true,false,true,""
By,unfocused,468,483,false,false,true,""
By,unfocused,487,502,false,false,true,""
It,unfocused,510,577,true,false,true,""
By,unfocused,538,553,false,false,true,""
By,unfocused,557,572,false,false,true,""
Loading

0 comments on commit e6e3b98

Please sign in to comment.