Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions tests/test_opencode_agent_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,14 @@ def test_opencode_coverage_prefers_declared_pnpm_runner_before_npm():

def test_opencode_coverage_discovers_changed_nested_javascript_package(tmp_path):
"""A changed JS file must select its nearest nested package.json for coverage."""
bash = shutil.which("bash")
if bash is None:
pytest.skip("bash is required for the extracted workflow function regression test")
try:
subprocess.run([bash, "--version"], capture_output=True, text=True, timeout=5, check=True)
except (OSError, subprocess.SubprocessError) as exc:
pytest.skip(f"bash is not usable for this regression test: {exc}")

workflow = Path(".github/workflows/opencode-review.yml").read_text(encoding="utf-8")
measure_start = workflow.index(" - name: Measure test and docstring evidence\n")
measure_end = workflow.index("\n - name:", measure_start + 1)
Expand Down Expand Up @@ -325,13 +333,17 @@ def test_opencode_coverage_discovers_changed_nested_javascript_package(tmp_path)
env = os.environ.copy()
env.update({"PR_BASE_SHA": base_sha, "PR_HEAD_SHA": head_sha})

result = subprocess.run(
["bash", "-c", shell],
cwd=repo,
env=env,
capture_output=True,
text=True,
)
try:
result = subprocess.run(
[bash, "-c", shell],
cwd=repo,
env=env,
capture_output=True,
text=True,
timeout=30,
)
except subprocess.TimeoutExpired as exc:
pytest.fail(f"nested JavaScript package discovery did not finish: {exc}")

assert result.returncode == 0, result.stderr
assert result.stdout.splitlines() == ["ADFS 연동 라이브러리/Node.JS/Node App"]
Expand Down
Loading