Fix the mechanism that ts_web_test uses to keep the Karma window open under bazel test.

It was broken by the new `--direct_run` feature in Bazel 0.14

Fixes #224

PiperOrigin-RevId: 204032910
diff --git a/internal/karma/ts_web_test.bzl b/internal/karma/ts_web_test.bzl
index cacc1d7..17bbe4e 100644
--- a/internal/karma/ts_web_test.bzl
+++ b/internal/karma/ts_web_test.bzl
@@ -122,9 +122,11 @@
 export HOME=$(mktemp -d)
 ARGV=( "start" $CONF )
 
-# Detect that we are running as a test, by using a well-known environment
-# variable. See go/test-encyclopedia
-if [ ! -z "$TEST_TMPDIR" ]; then
+# Detect that we are running as a test, by using well-known environment
+# variables. See go/test-encyclopedia
+# Note: in Bazel 0.14 and later, TEST_TMPDIR is set for both bazel test and bazel run
+# so we also check for the BUILD_WORKSPACE_DIRECTORY which is set only for bazel run
+if [[ ! -z "${{TEST_TMPDIR}}" && ! -n "${{BUILD_WORKSPACE_DIRECTORY}}" ]]; then
   ARGV+=( "--single-run" )
 fi