rules_nodejs
rules_nodejs copied to clipboard
cypress_web_test cannot expand locations in env as documented
🐞 bug report
Affected Rule
cypress_web_test
Is this a regression?
Not sure, but it does not match the documented behavior.
Description
Attempting to use any location expansion in cypress_web_test results in an error. This is because of this code, which creates a list with an embedded list that is eventually passed to ctx.expand_location which rejects this format.
🔬 Minimal Reproduction
Any cypress_web_test rule with an env expansion like: env = { "FOO": "//:foo" }
🔥 Exception or Error
Traceback (most recent call last):
File "/home/david/.cache/bazel/_bazel_david/7d1037d21a52700832f2c490bcd1c89d/external/npm/@bazel/cypress/internal/cypress_web_test.bzl", line 113, column 48, in _cypress_web_test_impl
return nodejs_test_kwargs["implementation"](
File "/home/david/.cache/bazel/_bazel_david/7d1037d21a52700832f2c490bcd1c89d/external/build_bazel_rules_nodejs/internal/node/node.bzl", line 206, column 75, in _nodejs_binary_impl
env_vars += "export %s=%s\n" % (key, expand_location_into_runfiles(ctx, value, data))
File "/home/david/.cache/bazel/_bazel_david/7d1037d21a52700832f2c490bcd1c89d/external/build_bazel_rules_nodejs/internal/common/expand_into_runfiles.bzl", line 111, column 40, in expand_location_into_runfiles
path += ctx.expand_location(input[i:j], targets)
Error in expand_location: at index 0 of targets, got element of type list, want Target
🌍 Your Environment
Operating System:
Ubuntu Linux 20.04
Output of bazel version
:
Bazelisk version: v1.11.0 Build label: 6.0.0-pre.20211215.3 Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Tue Dec 21 19:45:47 2021 (1640115947) Build timestamp: 1640115947 Build timestamp as int: 1640115947
Also reproduces onBazelisk version: v1.11.0 Build label: 4.2.2 Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Thu Dec 2 18:15:58 2021 (1638468958) Build timestamp: 1638468958 Build timestamp as int: 1638468958
Rules_nodejs version:
(Please check that you have matching versions between WORKSPACE file and @bazel/*
npm packages.)
4.6.0
Anything else relevant?
doing env: {"X": "$(execpath :my-file)"}
crashes Bazel completely