Skip to content

Commit

Permalink
Merge pull request #35 from robotomize/34-wrong-prefix-parsing
Browse files Browse the repository at this point in the history
fix prefix
  • Loading branch information
robotomize committed Aug 31, 2023
2 parents 0563ea8 + 699200b commit 512436e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion internal/exporter/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ func (e *exporter) Export() (Report, error) {
// Generate a unique ID for the Allure test case and determine its status based on the Go test status.
id := uuid.New().String()
status := e.convertStatus(goTest, testCase.Log)
if len(status) == 0 {
continue
}

allureTestCase := allure.Test{
UUID: id,
Expand Down Expand Up @@ -232,6 +235,11 @@ func (e *exporter) addStep(allureObj any, testCase gotest.NestedTest, ch chan<-
// Get the test case name and status and create an Allure step with it.
name := goTest.Name
status := e.convertStatus(goTest, tc.Log)
if len(status) == 0 {
// @TODO verbose this
continue
}

if status == allure.StatusBroken {
switch obj := allureObj.(type) {
case *allure.Test:
Expand Down Expand Up @@ -337,7 +345,6 @@ func (*exporter) convertStatus(goTest gotest.Test, log []byte) string {
case gotest.ActionPass:
status = allure.StatusPass
default:
status = allure.StatusBroken
}

return status
Expand Down
2 changes: 1 addition & 1 deletion internal/gotest/prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (t *prefixNode) isChildExist(obj *Test, key string) bool {
}

// If the key is a subtest of a child's key, create a new child node that combines the two and add it to the Children slice.
if strings.HasPrefix(n.Key, key) {
if strings.HasPrefix(n.Key, key) && strings.Count(key, "/") > strings.Count(n.Key, "/") {
if curr != nil {
curr.Children = append(curr.Children, n)
t.Children = append(t.Children[:idx], t.Children[idx+1:]...)
Expand Down

0 comments on commit 512436e

Please sign in to comment.