| # Dummy test target that imports various targets from the |
| # "@nodejs" repository. If a target of the repository is |
| # misconfigured, Bazel will complain about missing input files. |
| sh_test( |
| name = "test_default", |
| srcs = ["test.sh"], |
| data = [ |
| "@nodejs//:node", |
| "@nodejs//:node_bin", |
| "@nodejs//:node_files", |
| "@nodejs//:npm", |
| "@nodejs//:npm_bin", |
| "@nodejs//:npm_files", |
| ], |
| ) |
| |
| # Additional targets to test the use of parallel node toolchains |
| [ |
| sh_test( |
| name = "test_" + id, |
| srcs = ["test.sh"], |
| data = [ |
| "@%s_host//:node" % id, |
| "@%s_host//:node_bin" % id, |
| "@%s_host//:node_files" % id, |
| "@%s_host//:npm" % id, |
| "@%s_host//:npm_bin" % id, |
| "@%s_host//:npm_files" % id, |
| "@%s_host//:npx_bin" % id, |
| ], |
| ) |
| for id in [ |
| "node14", |
| "node16_nvmrc", |
| ] |
| ] |
| |
| [ |
| sh_test( |
| name = "test_node_version_%s_%s" % (bin, id), |
| srcs = ["version_test.sh"], |
| args = select({ |
| "@bazel_tools//src/conditions:linux_x86_64": [ |
| "%s_linux_amd64/bin" % id, |
| bin, |
| ], |
| "@bazel_tools//src/conditions:darwin": [ |
| "%s_darwin_arm64/bin" % id, |
| bin, |
| ], |
| "@bazel_tools//src/conditions:windows": [ |
| "%s_windows_amd64/bin" % id, |
| bin, |
| ".cmd", |
| ], |
| }), |
| data = [ |
| "@%s_host//:%s" % (id, bin), |
| "@%s_host//:node" % id, |
| "@bazel_tools//tools/bash/runfiles", |
| ], |
| ) |
| for (id, bin) in [ |
| # Node 14 doesn't include the node version in npx --help --verbose so we only test npm |
| ("node14", "npm"), |
| ("node16_nvmrc", "npm"), |
| ("node16_nvmrc", "npx"), |
| ] |
| ] |