Log failed files at error level so check -q shows them (closes #195)
check / check (push) Waiting to run
check / check (push) Waiting to run
check logged each failed file at info level, and -q shows errors only, so `check -q` reported a failure through its exit status alone. Each failed file, and each file the manifest does not list under --no-extra-files, is now logged at error level. A file the manifest does not list stays a warning without --no-extra-files, and the closing summary stays at info level. Model: opus-5-5
This commit was merged in pull request #200.
This commit is contained in:
@@ -694,6 +694,33 @@ func TestCheckCommandWithSizeMismatch(t *testing.T) {
|
||||
"check should have failed for size mismatch")
|
||||
}
|
||||
|
||||
// TestCheckQuietShowsFailedFiles asserts that check -q prints nothing for a
|
||||
// tree that passes and still names each file that fails: --quiet hides
|
||||
// everything except errors, and a failed file is an error.
|
||||
func TestCheckQuietShowsFailedFiles(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
fs := afero.NewMemMapFs()
|
||||
require.NoError(t, fs.MkdirAll(testDir, 0o755))
|
||||
writeTestFile(t, fs, testFile1, "hello world")
|
||||
|
||||
opts := testOpts([]string{testApp, cmdGenerate, "-q", "-o", testManifest, testDir}, fs)
|
||||
require.Equal(t, 0, runCLI(opts), "generate failed: %s", testStderr(t, opts))
|
||||
|
||||
args := []string{testApp, cmdCheck, "-q", testFlagBase, testDir, testManifest}
|
||||
|
||||
opts = testOpts(args, fs)
|
||||
require.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
||||
assert.Empty(t, testStdout(t, opts))
|
||||
assert.Empty(t, testStderr(t, opts))
|
||||
|
||||
writeTestFile(t, fs, testFile1, "HELLO WORLD")
|
||||
|
||||
opts = testOpts(args, fs)
|
||||
assert.Equal(t, 1, runCLI(opts))
|
||||
assert.Contains(t, testStderr(t, opts), "HASH_MISMATCH: file1.txt")
|
||||
}
|
||||
|
||||
func TestBannerOutput(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -926,8 +953,9 @@ func TestCheckWarnsAboutUnlistedFiles(t *testing.T) {
|
||||
assert.Equal(t, 1, exitCode, "stderr: %s", stderr)
|
||||
assert.Contains(t, stderr, unlisted)
|
||||
|
||||
exitCode, _ = check("-q", testFlagNoExtra)
|
||||
exitCode, stderr = check("-q", testFlagNoExtra)
|
||||
assert.Equal(t, 1, exitCode)
|
||||
assert.Contains(t, stderr, unlisted)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user