Skip to content

Commit

Permalink
feat: add file assertion library for bats tests (#2842)
Browse files Browse the repository at this point in the history
Adds the file assertion library for bats tests,
https://github.com/bats-core/bats-file

Split out from #2835

GitOrigin-RevId: fa2fe77c742a0066e660cdc59ac545207a7fcb62
  • Loading branch information
mattem authored and gregmagolan committed Jul 21, 2023
1 parent 15e443f commit c9d1af9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions integration_tests/bats.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def bats_test(srcs = [], **kwargs):
"@bats_assert//:dir",
"@bats_support//:dir",
"@bats_detik//:dir",
"@bats_file//:dir",
]
env = kwargs.pop("env", {})

Expand All @@ -26,6 +27,7 @@ def bats_test(srcs = [], **kwargs):
],
deps = [
"@bats_assert//:bats_assert",
"@bats_file//:bats_file",
"@bats_core//:bats_core",
"@bats_core//:bin",
"@bats_detik//:bats_detik",
Expand Down
30 changes: 30 additions & 0 deletions integration_tests/bats_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
CORE_VERSION = "1.8.2"
ASSERT_VERSION = "2.1.0"
SUPPORT_VERSION = "0.3.0"
FILES_VERSION = "c0f822aceac6a70614c5a7c92fd9c5ddd97c7f83" # May 25, 2023
DETIK_VERSION = "0d71702f9016a955fc8197d562bb1bb88ddf63a8" # Aug 8, 2022

def bats_dependencies():
"""Fetches the required dependencies to run bats_test"""

http_archive(
name = "bats_core",
sha256 = "0f2df311a536e625a72bff64c838e67c7b5032e6ea9edcdf32758303062b2f3b",
Expand Down Expand Up @@ -59,6 +62,33 @@ sh_library(
""",
)

http_archive(
name = "bats_file",
urls = [
"https://github.com/bats-core/bats-file/archive/{}.tar.gz".format(FILES_VERSION),
],
sha256 = "76a19ead26c7cf666b9fbe659874b947392443de638f76802f057739f04a8d33",
strip_prefix = "bats-file-{}".format(FILES_VERSION),
add_prefix = "bats-file",
build_file_content = """
sh_library(
name = "bats_file",
srcs = glob([
"bats-file/src/**",
"bats-file/load.bash",
]),
visibility = ["//visibility:public"]
)
sh_library(
name = "dir",
srcs = [
"bats-file",
],
visibility = ["//visibility:public"]
)
""",
)

http_archive(
name = "bats_support",
urls = [
Expand Down

0 comments on commit c9d1af9

Please sign in to comment.