Merge pull request #46 from terrastruct/e2ereport

Add e2ereport script
This commit is contained in:
ejulio-ts 2022-11-05 08:42:10 -03:00 committed by GitHub
commit 7a55e9c5f1
2 changed files with 17 additions and 2 deletions

15
ci/e2ereport.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/sh
set -eu
export REPORT_OUTPUT="out/e2e_report.html"
rm -f $REPORT_OUTPUT
FORCE_COLOR=1 DEBUG=1 go run ./e2etests/report/main.go "$@";
if [ -z "${NO_OPEN:-}" ]; then
if [ -s "$REPORT_OUTPUT" ]; then
open "$REPORT_OUTPUT"
else
echo "The report is empty"
fi
fi

View file

@ -140,10 +140,10 @@ func main() {
Tests: tests,
}
path := "e2e_report.html"
path := os.Getenv("REPORT_OUTPUT")
f, err := os.Create(path)
if err != nil {
panic(err)
panic(fmt.Errorf("error creating file `%s`. %v", path, err))
}
if err := tmpl.Execute(f, tmplData); err != nil {
panic(err)