Merge pull request #472 from gavin-ts/fix-e2ereport-with-delta-flag

fix e2ereport script with delta flag
This commit is contained in:
gavin-ts 2022-12-19 18:29:43 -08:00 committed by GitHub
commit 23d253f7b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -3,6 +3,7 @@ set -eu
export REPORT_OUTPUT="out/e2e_report.html"
rm -f $REPORT_OUTPUT
export E2E_REPORT=1
FORCE_COLOR=1 DEBUG=1 go run ./e2etests/report/main.go "$@";

View file

@ -131,7 +131,11 @@ func run(t *testing.T, tc testCase) {
assert.Success(t, err)
err = ioutil.WriteFile(pathGotSVG, svgBytes, 0600)
assert.Success(t, err)
defer os.Remove(pathGotSVG)
// if running from e2ereport.sh, we want to keep .got.svg on a failure
forReport := os.Getenv("E2E_REPORT") != ""
if !forReport {
defer os.Remove(pathGotSVG)
}
var xmlParsed interface{}
err = xml.Unmarshal(svgBytes, &xmlParsed)
@ -143,6 +147,9 @@ func run(t *testing.T, tc testCase) {
err = diff.Testdata(filepath.Join(dataPath, "sketch"), ".svg", svgBytes)
assert.Success(t, err)
}
if forReport {
os.Remove(pathGotSVG)
}
}
}