File
Blob: .opencode/commands/find-test.md
description: Find the Bazel test target for a source file subtask: true
Find the Bazel test target(s) for the file: $ARGUMENTS
Steps:
- Determine the directory containing the file.
- Look for a
BUILD.bazelfile in that directory (or the nearest parent with one). - Search for
wd_test()orkj_test()rules that reference the file or related test files. For Rust files (.rsundersrc/rust/), search forwd_rust_crate()rules which auto-generate<name>_testtargets, and check for companion C++ test files (e.g.,ffi-test.c++) that test the FFI bridge. Also check for inline#[cfg(test)]modules within the.rsfile itself. - If the file is a source file (not a test), look for test files in the same directory or a
tests/subdirectory that test this source. - Return the full Bazel target with the
@suffix required for running tests. For Rust test targets, the suffix is_test(e.g.,//src/rust/jsg:jsg_test).
Output format:
- The exact
just testorbazel testcommand to run - List all variants if relevant (
@,@all-compat-flags,@all-autogates) - If no test target is found, suggest how to create one using
just new-test