I have not tested this, but there is std.Build.Step.Run.addFileInput
which appears to let you add additional files that the run step should check when determining whether any of its inputs has changes. In theory, you might be able to do something like this
const tests = b.addTest(...);
const run_tests = b.addRunArtifact(tests);
run_tests.addFileInput(b.path("test_inputs/test1/file1.txt"));
You can only add files, not directories, so you would need to add each file individually.