Honor explicit report directory for file output

This commit is contained in:
2026-10-03 13:46:50 +00:00
parent 990ca0b71a
commit ddfc3dd4c7
6 changed files with 53 additions and 16 deletions

View File

@@ -805,9 +805,14 @@ func TestSubprocessReportingAndDebugSelections(t *testing.T) {
{false, false}, {false, true}, {true, false}, {true, true},
} {
f := newProcessFixture(t, "normal", "[grammar]")
extra := []string{"--reporting=false", "--report-dir", filepath.Join(f.dir, "missing")}
reportDir := filepath.Join(f.dir, "missing")
extra := []string{"--reporting=false", "--report-dir", reportDir}
if selection.reporting {
extra = []string{"--reporting=true", "--report-dir", filepath.Join(f.dir, "missing")}
reportDir = filepath.Join(f.dir, "selected-reports")
if err := os.Mkdir(reportDir, 0700); err != nil {
t.Fatal(err)
}
extra = []string{"--reporting=true", "--report-dir", reportDir}
}
if selection.debug {
extra = append(extra, "--debug")
@@ -827,7 +832,7 @@ func TestSubprocessReportingAndDebugSelections(t *testing.T) {
t.Fatalf("selection changed processing: %+v summary=%q output=%s", selection, summary, output)
}
for _, name := range []string{"errors.yml", "recoveries.yml", "report.md"} {
_, err := os.Stat(filepath.Join(f.dir, name))
_, err := os.Stat(filepath.Join(reportDir, name))
if selection.reporting && err != nil || !selection.reporting && !os.IsNotExist(err) {
t.Fatalf("selection=%+v report %s: %v", selection, name, err)
}