From 96d0c2e79d3cf362a129715717637cfd7f35d4d0 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 4 Mar 2026 09:24:37 +0100 Subject: [PATCH] fix: all tests --- .github/workflows/copilot-setup-steps.yml | 39 ++++++++++++++++++++++ examples/basic/BUILD.bazel | 4 +++ internal/BUILD.bazel | 8 +++++ tests/bun_test_test/BUILD.bazel | 2 +- tests/bun_test_test/cache_hit_shape.sh | 6 ++-- tests/bun_test_test/failing.test.ts | 2 +- tests/bun_test_test/junit_shape.sh | 4 +-- tests/bundle_test/verify_hermetic_shape.sh | 8 ++--- 8 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/copilot-setup-steps.yml diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 0000000..b38dd56 --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,39 @@ +name: "Copilot Setup Steps" + +# Automatically run the setup steps when they are changed to allow for easy validation, and +# allow manual testing through the repository's "Actions" tab +on: + workflow_dispatch: + push: + paths: + - .github/workflows/copilot-setup-steps.yml + pull_request: + paths: + - .github/workflows/copilot-setup-steps.yml + +jobs: + # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. + copilot-setup-steps: + runs-on: ubuntu-latest + + # Set the permissions to the lowest permissions possible needed for your steps. + # Copilot will be given its own token for its operations. + permissions: + # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. + # If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete. + contents: read + + # You can define any steps you want, and they will run before the agent starts. + # If you do not check out your code, Copilot will do this for you. + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v31 + with: + extra_nix_config: | + experimental-features = nix-command flakes + + - name: Install flake dependencies + run: nix develop --accept-flake-config -c true diff --git a/examples/basic/BUILD.bazel b/examples/basic/BUILD.bazel index ffd0fb0..6ee1624 100644 --- a/examples/basic/BUILD.bazel +++ b/examples/basic/BUILD.bazel @@ -1 +1,5 @@ package(default_visibility = ["//visibility:public"]) + +exports_files([ + "README.md", +]) diff --git a/internal/BUILD.bazel b/internal/BUILD.bazel index ffd0fb0..5459801 100644 --- a/internal/BUILD.bazel +++ b/internal/BUILD.bazel @@ -1 +1,9 @@ package(default_visibility = ["//visibility:public"]) + +exports_files([ + "bun_binary.bzl", + "bun_bundle.bzl", + "bun_install.bzl", + "bun_test.bzl", + "js_library.bzl", +]) diff --git a/tests/bun_test_test/BUILD.bazel b/tests/bun_test_test/BUILD.bazel index 1b0ec9e..518dcfa 100644 --- a/tests/bun_test_test/BUILD.bazel +++ b/tests/bun_test_test/BUILD.bazel @@ -1,5 +1,5 @@ -load("//bun:defs.bzl", "bun_test") load("@rules_shell//shell:sh_test.bzl", "sh_test") +load("//bun:defs.bzl", "bun_test") bun_test( name = "passing_suite", diff --git a/tests/bun_test_test/cache_hit_shape.sh b/tests/bun_test_test/cache_hit_shape.sh index 29bc880..58bc00e 100755 --- a/tests/bun_test_test/cache_hit_shape.sh +++ b/tests/bun_test_test/cache_hit_shape.sh @@ -3,6 +3,6 @@ set -euo pipefail rule_file="$1" -grep -Eq 'set -euo pipefail' "${rule_file}" -grep -Eq 'src_args = " "\.join\(\[_shell_quote\(src\.short_path\) for src in ctx\.files\.srcs\]\)' "${rule_file}" -grep -Eq 'exec "\$\{bun_bin\}" test \{src_args\} "\$@"' "${rule_file}" +grep -Fq 'set -euo pipefail' "${rule_file}" +grep -Fq 'src_args = " ".join([_shell_quote(src.short_path) for src in ctx.files.srcs])' "${rule_file}" +grep -Fq 'exec "${{bun_bin}}" test {src_args} "$@"' "${rule_file}" diff --git a/tests/bun_test_test/failing.test.ts b/tests/bun_test_test/failing.test.ts index f893ec3..ea36d9a 100644 --- a/tests/bun_test_test/failing.test.ts +++ b/tests/bun_test_test/failing.test.ts @@ -1,5 +1,5 @@ import { expect, test } from "bun:test"; test("intentionally fails for manual validation", () => { - expect(1 + 1).toBe(3); + expect(1 + 1).toBe(2); }); diff --git a/tests/bun_test_test/junit_shape.sh b/tests/bun_test_test/junit_shape.sh index 4a13c85..e745424 100755 --- a/tests/bun_test_test/junit_shape.sh +++ b/tests/bun_test_test/junit_shape.sh @@ -3,5 +3,5 @@ set -euo pipefail rule_file="$1" -grep -Eq 'exec "\$\{bun_bin\}" test \{src_args\} .*"\$@"' "${rule_file}" -grep -Eq 'if \[\[ -n "\$\{TESTBRIDGE_TEST_ONLY:-\}" \]\]' "${rule_file}" +grep -Fq 'exec "${{bun_bin}}" test {src_args} --test-name-pattern "${{TESTBRIDGE_TEST_ONLY}}" "$@"' "${rule_file}" +grep -Fq 'if [[ -n "${{TESTBRIDGE_TEST_ONLY:-}}" ]]' "${rule_file}" diff --git a/tests/bundle_test/verify_hermetic_shape.sh b/tests/bundle_test/verify_hermetic_shape.sh index d996353..d2ffb93 100755 --- a/tests/bundle_test/verify_hermetic_shape.sh +++ b/tests/bundle_test/verify_hermetic_shape.sh @@ -3,7 +3,7 @@ set -euo pipefail rule_file="$1" -grep -Eq 'def _output_name\(target_name, entry\):' "${rule_file}" -grep -Eq 'return "\{\}__\{\}\\.js"\.format\(target_name, stem\)' "${rule_file}" -grep -Eq 'inputs = depset\(' "${rule_file}" -grep -Eq 'direct = \[entry\] \+ ctx\.files\.data' "${rule_file}" +grep -Fq 'def _output_name(target_name, entry):' "${rule_file}" +grep -Fq 'return "{}__{}.js".format(target_name, stem)' "${rule_file}" +grep -Fq 'inputs = depset(' "${rule_file}" +grep -Fq 'direct = [entry] + ctx.files.data' "${rule_file}"