Skip to content

Commit

Permalink
Adding expansion.bzl for Improved Env Var Expansion
Browse files Browse the repository at this point in the history
This is one approach for improving `bats_test` environment variable expansion logic (to get at least parity with built-in expansion logic).
See https://github.com/CauhxMilloy/bazel-bats/tree/improvedExpansionWithShTest for `sh_test` approach.

* Adding `expansion.bzl` directly to this project.
  * Allows for better environment variable expansion than built-in skylark methods.
  * I'm also trying to submit this to Skylib (bazelbuild/bazel-skylib#486).
    * I could add this here (instead or in addition to).
    * Obviously, (also) adding this to Skylib would be more reusable for more repos.
    * Once submitted to Skylib (if accepted), this addition of `expansion.bzl` could be replaced with referencing the one in Skylib.
      * Doing this would add an extra dependency for bazel-bats (needing to pull in Skylib in `bazel_bats_dependencies()`).
      * Alternatively, could just keep this file here (for no extra dependency).
* Updating `env` attribute expansion logic in `_bats_test_impl()`.
  * Allows better environment expansion logic than previously used.
* Updating `tests/hello_world.bats` to validate many different environment variable expansion configurations.
  • Loading branch information
CauhxMilloy committed Jan 29, 2024
1 parent 4aa002f commit 46b87e5
Show file tree
Hide file tree
Showing 4 changed files with 851 additions and 22 deletions.

0 comments on commit 46b87e5

Please sign in to comment.