Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix prefix #35

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading