Skip to content

Bazel run uses headless chrome #1881

Closed
Closed

Description

@Serginho

🐞 bug report

Affected Rule

karma_web_test_suite

Is this a regression?

yes

Description

After reset OS X catalina and reinstall my project. Bazel run isn't opening chromium, instead of that, it opens headless chrome.

Apparently nothing changes, I think there is a bug here, but something in my cache or previous downloaded files have been hidding.

I've tried to use angular-cli empty project with the same results.

Versions

In my project:

Bazel: 2.1.0
Rules nodejs: 1.6.1
Angular Cli: 9.1.5
NodeJs: 10.16.3

🔬 Minimal Reproduction

ng new bazel --collection=@angular/bazel
yarn ng build --leaveBazelFilesOnDisk
yarn bazel run //src:test

🔥 Exception or Error

yarn run v1.22.4
$ /Users/astrum/tulotero/bazel/node_modules/.bin/bazel run //src:test
INFO: Analyzed target //src:test_chromium-local (124 packages loaded, 2245 targets configured).
INFO: Found 1 target...
Target //src:test_chromium-local up-to-date:
  dist/bin/src/test_chromium-local.gen.json
  dist/bin/src/test_chromium-local.sh
INFO: Elapsed time: 32.975s, Critical Path: 18.67s
INFO: 7 processes: 4 local, 3 worker.
INFO: Build completed successfully, 33 total actions
INFO: Build completed successfully, 33 total actions
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //src:test_chromium-local
-----------------------------------------------------------------------------
GREP_COLOR=1;32
npm_package_devDependencies__bazel_typescript=1.6.0
GTEST_TMP_DIR=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/_tmp/ecb68a7d1ce0def939867d45e94d6473
TEST_INFRASTRUCTURE_FAILURE_FILE=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/testlogs/src/test_chromium-local/test.infrastructure_failure
npm_package_dependencies__angular_forms=~9.1.6
npm_package_dependencies__angular_router=~9.1.6
npm_package_devDependencies__angular_bazel=~9.1.6
TERM_PROGRAM=iTerm.app
TEST_SRCDIR=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/bin/src/test_chromium-local.sh.runfiles
NODE=/usr/local/bin/node
npm_config_version_git_tag=true
npm_package_devDependencies_rollup_plugin_commonjs=10.1.0
npm_package_devDependencies_typescript=~3.8.3
INIT_CWD=/Users/astrum/tulotero/bazel/src
TERM=xterm-256color
SHELL=/bin/zsh
WEB_TEST_METADATA=project/src/test_chromium-local.gen.json
JAVA_RUNFILES=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/bin/src/test_chromium-local.sh.runfiles
npm_package_dependencies__angular_platform_browser_dynamic=~9.1.6
_RLOCATION_ISABS_PATTERN=^/[^/].*
npm_package_dependencies__angular_animations=~9.1.6
npm_package_devDependencies__bazel_karma=1.6.0
npm_package_devDependencies_tslint=~6.1.0
TMPDIR=/var/folders/py/wz22glgj44x2jlwj_fl2h4k80000gn/T/
npm_config_init_license=MIT
npm_package_scripts_lint=ng lint
npm_package_devDependencies_history_server=1.3.1
TERM_PROGRAM_VERSION=3.3.9
TEST_UNUSED_RUNFILES_LOG_FILE=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/testlogs/src/test_chromium-local/test.unused_runfiles_log
npm_package_devDependencies__bazel_bazel=2.1.0
TERM_SESSION_ID=w0t0p0:C6DB9AF5-ED57-43A6-8BC4-1BA8AE6A397F
npm_config_registry=https://registry.yarnpkg.com
npm_package_private=true
npm_package_devDependencies_karma_jasmine=2.0.1
TEST_LOGSPLITTER_OUTPUT_FILE=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/testlogs/src/test_chromium-local/test.raw_splitlogs/test.splitlogs
ZSH=/Users/astrum/.oh-my-zsh
TEST_BINARY=src/test_chromium-local.sh
npm_package_readmeFilename=README.md
npm_package_description=This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.5.
USER=astrum
npm_package_devDependencies__bazel_rollup=1.6.0
TEST_UNDECLARED_OUTPUTS_DIR=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/testlogs/src/test_chromium-local/test.outputs
npm_package_devDependencies_jasmine_core=~3.5.0
TEST_TIMEOUT=900
RUNFILES_DIR=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/bin/src/test_chromium-local.sh.runfiles
npm_package_devDependencies_karma=4.4.1
npm_package_devDependencies__types_jasminewd2=~2.0.3
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.27bKLLL0Zr/Listeners
npm_package_devDependencies_html_insert_assets=0.5.0
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x8
npm_package_scripts_e2e=ng e2e
npm_execpath=/Users/astrum/.npm-global/lib/node_modules/yarn/bin/yarn.js
PAGER=less
npm_package_devDependencies_protractor=5.4.2
LSCOLORS=ExfxbEaEBxxEhEhBaDaCaD
TEST_TARGET=//src:test_chromium-local
npm_package_scripts_postinstall=ngcc --properties es2015 browser module main
npm_package_devDependencies_jasmine_spec_reporter=~4.2.1
npm_config_argv={"remain":[],"cooked":["run","bazel"],"original":["bazel","run","//src:test"]}
PATH=.:/bin:/usr/bin:/usr/local/bin
TEST_TEMPDIR=test_tempdir.dMV1Z8
npm_package_devDependencies_rollup=1.27.5
npm_package_devDependencies_karma_chrome_launcher=3.1.0
npm_package_dependencies__angular_platform_browser=~9.1.6
npm_package_devDependencies_terser=4.4.0
PWD=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/bin/src/test_chromium-local.sh.runfiles/project
npm_lifecycle_event=bazel
npm_package_name=bazel
LANG=es_ES.UTF-8
TEST_WARNINGS_OUTPUT_FILE=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/testlogs/src/test_chromium-local/test.warnings
ITERM_PROFILE=Default
TZ=UTC
npm_config_version_commit_hooks=true
npm_package_scripts_start=ng serve
npm_package_scripts_build=ng build
npm_package_dependencies_rxjs=~6.5.4
npm_package_devDependencies_karma_coverage_istanbul_reporter=~2.1.0
npm_package_dependencies_zone_js=~0.10.2
XPC_FLAGS=0x0
npm_config_bin_links=true
npm_package_devDependencies__angular_cli=~9.1.5
npm_package_version=0.0.0
npm_package_scripts_ng=ng
XPC_SERVICE_NAME=0
TEST_UNDECLARED_OUTPUTS_ANNOTATIONS_DIR=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/testlogs/src/test_chromium-local/test.outputs_manifest
npm_package_devDependencies__bazel_terser=1.6.0
SHLVL=5
HOME=/Users/astrum
COLORFGBG=15;0
npm_package_scripts_test=ng test
npm_package_devDependencies__angular_compiler_cli=~9.1.6
RUN_UNDER_RUNFILES=1
npm_config_strict_ssl=true
npm_config_save_prefix=^
GREP_OPTIONS=--color=auto --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn
LC_TERMINAL_VERSION=3.3.9
TEST_SIZE=large
BUILD_WORKING_DIRECTORY=/Users/astrum/tulotero/bazel
npm_config_version_git_message=v%s
npm_package_devDependencies_karma_firefox_launcher=1.2.0
npm_package_dependencies__angular_compiler=~9.1.6
npm_package_devDependencies_ts_node=~8.3.0
ITERM_SESSION_ID=w0t0p0:C6DB9AF5-ED57-43A6-8BC4-1BA8AE6A397F
TEST_TMPDIR=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/_tmp/ecb68a7d1ce0def939867d45e94d6473
YARN_WRAP_OUTPUT=false
LESS=-R
LOGNAME=astrum
npm_package_devDependencies_karma_sourcemap_loader=0.3.7
npm_package_devDependencies_codelyzer=^5.1.2
npm_package_devDependencies_karma_requirejs=1.1.0
LC_CTYPE=es_ES.UTF-8
XML_OUTPUT_FILE=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/testlogs/src/test_chromium-local/test.xml
TEST_WORKSPACE=project
BUILD_WORKSPACE_DIRECTORY=/Users/astrum/tulotero/bazel
npm_package_dependencies__angular_common=~9.1.6
npm_package_devDependencies_karma_jasmine_html_reporter=^1.4.2
npm_package_devDependencies_rollup_plugin_node_resolve=5.2.0
npm_package_dependencies_tslib=^1.10.0
npm_config_user_agent=yarn/1.22.4 npm/? node/v12.16.3 darwin x64
npm_config_ignore_scripts=
npm_config_version_git_sign=
npm_package_dependencies__angular_core=~9.1.6
npm_package_devDependencies_requirejs=2.3.6
npm_package_devDependencies__types_node=^12.11.1
LC_TERMINAL=iTerm2
npm_config_ignore_optional=
npm_config_init_version=1.0.0
npm_package_devDependencies__types_jasmine=~3.5.0
PYTHON_RUNFILES=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/bin/src/test_chromium-local.sh.runfiles
TEST_PREMATURE_EXIT_FILE=/private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/testlogs/src/test_chromium-local/test.exited_prematurely
npm_package_devDependencies__bazel_protractor=1.6.0
npm_config_prefix=/Users/astrum/.npm-global
npm_config_version_tag_prefix=v
npm_package_devDependencies__bazel_ibazel=0.12.3
npm_node_execpath=/usr/local/bin/node
COLORTERM=truecolor
BASH_FUNC_rlocation%%=() {  if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
 echo "INFO[runfiles.bash]: rlocation($1): start" 1>&2;
 fi;
 if [[ "$1" =~ $_RLOCATION_ISABS_PATTERN ]]; then
 if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
 echo "INFO[runfiles.bash]: rlocation($1): absolute path, return" 1>&2;
 fi;
 echo "$1";
 else
 if [[ "$1" == ../* || "$1" == */.. || "$1" == ./* || "$1" == */./* || "$1" == "*/." || "$1" == *//* ]]; then
 if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
 echo "ERROR[runfiles.bash]: rlocation($1): path is not normalized" 1>&2;
 fi;
 return 1;
 else
 if [[ "$1" == \\* ]]; then
 if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
 echo "ERROR[runfiles.bash]: rlocation($1): absolute path without" "drive name" 1>&2;
 fi;
 return 1;
 else
 if [[ -e "${RUNFILES_DIR:-/dev/null}/$1" ]]; then
 if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
 echo "INFO[runfiles.bash]: rlocation($1): found under RUNFILES_DIR ($RUNFILES_DIR), return" 1>&2;
 fi;
 echo "${RUNFILES_DIR}/$1";
 else
 if [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
 if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
 echo "INFO[runfiles.bash]: rlocation($1): looking in RUNFILES_MANIFEST_FILE ($RUNFILES_MANIFEST_FILE)" 1>&2;
 fi;
 local -r result=$(grep -m1 "^$1 " "${RUNFILES_MANIFEST_FILE}" | cut -d ' ' -f 2-);
 if [[ -e "${result:-/dev/null}" ]]; then
 if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
 echo "INFO[runfiles.bash]: rlocation($1): found in manifest as ($result)" 1>&2;
 fi;
 echo "$result";
 else
 if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
 echo "INFO[runfiles.bash]: rlocation($1): not found in manifest" 1>&2;
 fi;
 echo "";
 fi;
 else
 if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
 echo "ERROR[runfiles.bash]: cannot look up runfile \"$1\" " "(RUNFILES_DIR=\"${RUNFILES_DIR:-}\"," "RUNFILES_MANIFEST_FILE=\"${RUNFILES_MANIFEST_FILE:-}\")" 1>&2;
 fi;
 return 1;
 fi;
 fi;
 fi;
 fi;
 fi
}
BASH_FUNC_runfiles_export_envvars%%=() {  if [[ ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" && ! -d "${RUNFILES_DIR:-/dev/null}" ]]; then
 return 1;
 fi;
 if [[ ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
 if [[ -f "$RUNFILES_DIR/MANIFEST" ]]; then
 export RUNFILES_MANIFEST_FILE="$RUNFILES_DIR/MANIFEST";
 else
 if [[ -f "${RUNFILES_DIR}_manifest" ]]; then
 export RUNFILES_MANIFEST_FILE="${RUNFILES_DIR}_manifest";
 else
 export RUNFILES_MANIFEST_FILE=;
 fi;
 fi;
 else
 if [[ ! -d "${RUNFILES_DIR:-/dev/null}" ]]; then
 if [[ "$RUNFILES_MANIFEST_FILE" == */MANIFEST && -d "${RUNFILES_MANIFEST_FILE%/MANIFEST}" ]]; then
 export RUNFILES_DIR="${RUNFILES_MANIFEST_FILE%/MANIFEST}";
 export JAVA_RUNFILES="$RUNFILES_DIR";
 else
 if [[ "$RUNFILES_MANIFEST_FILE" == *_manifest && -d "${RUNFILES_MANIFEST_FILE%_manifest}" ]]; then
 export RUNFILES_DIR="${RUNFILES_MANIFEST_FILE%_manifest}";
 export JAVA_RUNFILES="$RUNFILES_DIR";
 else
 export RUNFILES_DIR=;
 fi;
 fi;
 fi;
 fi
}
BASH_FUNC_is_absolute%%=() {  [[ "$1" = /* ]] || [[ "$1" =~ ^[a-zA-Z]:[/\\].* ]]
}
_=/usr/bin/printenv




Running karma tests
-----------------------------------------------------------------------------
version     : 4.4.1
pwd         : /private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/bin/src/test_chromium-local.sh.runfiles/project
conf        : /private/var/tmp/_bazel_astrum/9c6583209b42166759bee3ba091a5583/execroot/project/bazel-out/darwin-fastbuild/bin/src/test_chromium-local.sh.runfiles/project/src/test_wrapped_test.conf.js
node_options:

11 05 2020 10:50:59.396:INFO [karma-server]: Karma v4.4.1 server started at http://0.0.0.0:9876/
11 05 2020 10:50:59.399:INFO [launcher]: Launching browsers CustomChromeWithoutSandbox with concurrency unlimited
11 05 2020 10:50:59.408:INFO [launcher]: Starting browser ChromeHeadless
11 05 2020 10:51:02.170:INFO [HeadlessChrome 76.0.3809 (Mac OS X 10.15.4)]: Connected on socket n8KEvWVDjcFNcJjGAAAA with id 67308780

Activity

  1. Serginho commented on May 15, 2020

    @Serginho
    Author

    Even with --define DISPLAY=true opens headless chrome

  2. joeljeske commented on May 19, 2020

    @joeljeske
    Contributor

    Where you able to find a solution?

  3. Serginho commented on May 19, 2020

    @Serginho
    Author

    @joeljeske When you execute bazel run //target and chrome headless is opened, in the logs, you will find the url, just open it manually in your browser and you will get same behavior (localhost:9876 is in my case). Actually, I think this way is more confortable because when you use ibazel run //target, every time you change something in code, browser was reopened, now copying the url in your browser, you only have to press reload.

    I've closed the issue because no one tagged this issue, I'm seeing other recent issues have been tagged, so I think they are ignoring it.

  4. joeljeske commented on May 19, 2020

    @joeljeske
    Contributor

    Ahh yes that was the only solution I have found as well, yet I think it’s not how it is supposed to work.

    Would you mind reopening it?(if not I can create a new one).

    I think the issue is relevant, even if the docs are only updated to state the workaround you mentioned. I think the guys are busy but don’t give up on them :)

  5. Serginho commented on May 19, 2020

    @Serginho
    Author

    Ok, you re right. I'll keep it open.

  6. joeljeske commented on Jun 7, 2020

    @joeljeske
    Contributor

    @alexeagle any idea what could be causing this? I looked into the browser launching code, but amongst the karma launchers and the managed browser downloads I got a bit lost. Maybe you could point me in the right direction?

  7. alexeagle commented on Jun 7, 2020

    @alexeagle
    Collaborator

    @gregmagolan knows a lot more about this part.

  8. joeljeske commented on Jul 21, 2020

    @joeljeske
    Contributor

    @Serginho so it turns out you are correct that DISPLAY=true using --define=DISPLAY=true needs to be set when the test bootstraps in order to use the standard chrome. However, you must also pass that var name in order for the rule to use it.

    karma_web_test_suite(
      ...
      configuration_env_vars = ["DISPLAY"],
    )
    
  9. github-actions commented on Sep 20, 2020

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

  10. added
    Can Close?
    on Sep 20, 2020
  11. alexeagle commented on Sep 20, 2020

    @alexeagle
    Collaborator

    @joeljeske what do you think of #2202 to make this easier for the next person to find?

  12. joeljeske commented on Sep 20, 2020

    @joeljeske
    Contributor

    Yup that’s perfect thanks.

  13. added a commit that references this issue on Sep 20, 2020
    7bd9501
  14. added a commit that references this issue on Jan 15, 2021
    9671291
  15. added a commit that references this issue on Nov 5, 2025
    56b8f69
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Can Close?

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions