| load("@aspect_rules_js//js:defs.bzl", "js_run_binary", "js_test") |
| load("@bazel_lib//lib:testing.bzl", "assert_contains") |
| load("@npm//:defs.bzl", "npm_link_all_packages") |
| load("@npm//:less/package_json.bzl", less_bin = "bin") |
| |
| npm_link_all_packages() |
| |
| # A test consuming npm package, including testing of @bazel/runfiles |
| js_test( |
| name = "test", |
| data = [ |
| ":node_modules/@bazel/runfiles", |
| ], |
| entry_point = "test.js", |
| ) |
| |
| # The lessc binary |
| less_bin.lessc_binary( |
| name = "lessc", |
| visibility = ["//visibility:public"], |
| ) |
| |
| # A run_binary() |
| js_run_binary( |
| name = "run_lessc--help", |
| srcs = [], |
| args = [ |
| "--help", |
| ], |
| stdout = "less-help.log", |
| tool = ":lessc", |
| ) |
| |
| # Test to ensure the run_binary() was successful |
| assert_contains( |
| name = "test_lessc--help", |
| actual = "less-help.log", |
| expected = "usage: lessc [option option=parameter ...] <source> [destination]", |
| ) |