From 1871f2bf9e2bc63a222344b853756fd2babcfc72 Mon Sep 17 00:00:00 2001 From: Cesar Celis Hernandez Date: Wed, 12 Jan 2022 19:57:50 -0500 Subject: [PATCH] to fail test when yarn does not build (#1388) * to fail test when yarn does not build * Warnings cleanup (#1389) Signed-off-by: Benjamin Perez Co-authored-by: Benjamin Perez * to fail test when yarn does not build Co-authored-by: cniackz Co-authored-by: Alex <33497058+bexsoft@users.noreply.github.com> Co-authored-by: Benjamin Perez --- portal-ui/check-warnings.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/portal-ui/check-warnings.sh b/portal-ui/check-warnings.sh index 376820d42..6369d8217 100755 --- a/portal-ui/check-warnings.sh +++ b/portal-ui/check-warnings.sh @@ -1,6 +1,19 @@ #!/bin/bash -if yarn build | grep "Compiled with warnings"; then +yell() { echo "$0: $*" >&2; } + +die() { + yell "$*" + cat yarn.log + exit 111 +} + +try() { "$@" &> yarn.log || die "cannot $*"; } + +rm yarn.log +try yarn build + +if cat yarn.log | grep "Compiled with warnings"; then echo "There are warnings in the code" exit 1 fi