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

Reporter not seen #19

Open
objarni opened this issue Mar 23, 2021 · 3 comments
Open

Reporter not seen #19

objarni opened this issue Mar 23, 2021 · 3 comments

Comments

@objarni
Copy link
Contributor

objarni commented Mar 23, 2021

Hiya,

I tried using this lib for some approvals tonight, but the external reporter (Beyond Compare 4) I finally managed to configure - by writing my own - doesn't show up. After some more digging, this turns out to be because 'something' causes the process to die before the reporter window even shows up.

I switched my custom reporter to use cmd.Run() instead of cmd.Start() to 'prove' this.

Is there something I'm missing...?

Video of behaviour:

https://youtu.be/92SRqny-ojU

@objarni
Copy link
Contributor Author

objarni commented Mar 23, 2021

System: Ubuntu 20.04

Custom reporter code:

package tests

import (
	"github.com/approvals/go-approval-tests/reporters"
	"os/exec"
)

type beyondCompare struct{}

func NewBCompare() reporters.Reporter {
	return &beyondCompare{}
}

func (s *beyondCompare) Report(approved, received string) bool {
	cmd := exec.Command("/usr/bin/bcompare", approved, received)
	err := cmd.Start()   // Tried switching to Run(), then window does appear...
	if err != nil {
		panic(err)
	}
	return true
}

@objarni
Copy link
Contributor Author

objarni commented Mar 23, 2021

OK, what closes the reporter window is the test itself, because of the deferred call to r2.Close().

So a 'workaround' is not closing the reporter at all:

image

Is this the way others are using this library?

@objarni objarni changed the title Reporter windows never seen Reporter not seen Mar 23, 2021
@JanVanRyswyck
Copy link

I seem to have a similar issue on MacOS. I'm using GoLand, and I'm not seeing a diff window appear.
I also noticed that only the "received" file is being written, but no "approved" file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants