bazelbuild / rules_nodejs

NodeJS toolchain for Bazel.

Home Page:https://bazelbuild.github.io/rules_nodejs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular example Jasmine test not working

mtsgrd opened this issue Β· comments

🐞 bug report

Affected Rule

The issue is caused by the rule: examples/angular -> //src/app/hello-world:test

Is this a regression?

Yes, but no idea when the issue started.

Description

bazel test is meant to run the test once, bazel run is meant to leave the web server running, but neither of these successfully execute the test.

πŸ”¬ Minimal Reproduction


git clone https://github.com/bazelbuild/rules_nodejs.git
cd rules_nodejs/examples/angular
bazel run //examples/angular/src/app/hello-world:test

πŸ”₯ Exception or Error


bazel test //src/app/hello-world:test
INFO: Invocation ID: 88de4120-fdcb-4b29-89be-f1bf7009450b
DEBUG: /home/mattias/.cache/bazel/_bazel_mattias/51b9fe9cbedebfa28164cbbfc55b9ee0/external/build_bazel_rules_nodejs/index.bzl:73:14: yarn_install#yarn attribute not set and no repository named 'yarn' exists; installing default yarn
DEBUG: /home/mattias/.cache/bazel/_bazel_mattias/51b9fe9cbedebfa28164cbbfc55b9ee0/external/build_bazel_rules_nodejs/index.bzl:122:10: WARNING: check_rules_nodejs_version has been removed. This is a no-op, please remove the call.
INFO: Analyzed target //src/app/hello-world:test (0 packages loaded, 0 targets configured).
INFO: Found 1 target and 0 test targets...
Target //src/app/hello-world:test up-to-date:
  dist/bin/src/app/hello-world/test.sh
  dist/bin/src/app/hello-world/test_require_patch.cjs
INFO: Elapsed time: 0.245s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action

🌍 Your Environment

Operating System:

  
Distributor ID:	Ubuntu
Description:	Ubuntu 21.10
Release:	21.10
Codename:	impish
  

Output of bazel version:

  
Bazelisk version: v1.11.0
Build label: 5.2.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jun 7 16:02:26 2022 (1654617746)
Build timestamp: 1654617746
Build timestamp as int: 1654617746
  

This was just my own understanding coming in a bit short. The target is a macro that instantiates a few rules, among them:

[target].test.suite_firefox-local
[target].test.suite_chromium-local

Running these works as expected, albeit loading is a confusing message from the Karma server.

image

It's worth noting that I needed the --nobuild_runfile_links flag when testing on macOS. Also, bazel run [target] works on mac while bazel run [target].suite_chromium-local fails (link or target filename contains space).