Skip to content

Commit

Permalink
Adding expansion.bzl for Improved Env Var Expansion
Browse files Browse the repository at this point in the history
* 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.

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.
  • Loading branch information
CauhxMilloy committed Jan 30, 2024
1 parent 4aa002f commit d2a4772
Show file tree
Hide file tree
Showing 4 changed files with 856 additions and 22 deletions.
Loading

0 comments on commit d2a4772

Please sign in to comment.