Skip to content
Merged
Show file tree
Hide file tree
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
feat(fmt): align successful format check output
  • Loading branch information
chenjiahan committed Sep 1, 2026
commit be35ac1df9cc0d2395d15d74355ddb392e90cd69
7 changes: 3 additions & 4 deletions packages/rstack/src/fmt/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const logFmtResult = (
return;
}

const time = color.bold(formatDuration(durationMilliseconds));
const time = formatDuration(durationMilliseconds);

if (mode === 'write') {
if (writtenCount === 0 && result.exitCode !== 0) {
Expand All @@ -230,9 +230,8 @@ const logFmtResult = (
logger.error(`Formatting issues found in ${differentFiles}. ${fixHint}`);
logger.info(`Checked ${processedFiles} in ${time}.`);
} else if (result.exitCode === 0) {
logger.success(
`Checked ${formatFileCount(processedFileCount)} in ${time}. No issues found.`,
);
const files = `${processedFileCount} ${processedFileCount === 1 ? 'file' : 'files'}`;
logger.success(`Format check passed in ${time} ${color.dim(`(${files})`)}`);
}
};

Expand Down
2 changes: 1 addition & 1 deletion packages/rstack/tests/cli/check.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test('runs lint followed by a formatting check', () => {
const formatted = runCheck();

expect(formatted.status).toBe(0);
expect(formatted.stdout).toContain('No issues found.');
expect(formatted.stdout).toContain('Format check passed in');
expect(formatted.stderr).toBe('');
});

Expand Down
2 changes: 1 addition & 1 deletion packages/rstack/tests/cli/fmt/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ test('checks formatting without writing files', () => {

expect(formattedResult.status).toBe(0);
expect(normalizeDuration(formattedResult.stdout)).toBe(
'start Checking formatting...\nsuccess Checked 1 file in <duration>. No issues found.\n',
'start Checking formatting...\nsuccess Format check passed in <duration> (1 file)\n',
);
expect(formattedResult.stderr).toBe('');
});
Expand Down
5 changes: 3 additions & 2 deletions packages/rstack/tests/cli/fmt/patterns.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ test('allows no files to match with --no-error-on-unmatched-pattern', () => {

test('counts only supported files', () => {
writeProjectFile('index.ts', 'const value = 1;\n');
writeProjectFile('other.ts', 'const other = 2;\n');
writeProjectFile('notes.unknown', 'plain text');

const result = runFmt(['--check', 'index.ts', 'notes.unknown']);
const result = runFmt(['--check', 'index.ts', 'other.ts', 'notes.unknown']);

expect(result.status).toBe(0);
expect(normalizeDuration(result.stdout)).toBe(
'start Checking formatting...\nsuccess Checked 1 file in <duration>. No issues found.\n',
'start Checking formatting...\nsuccess Format check passed in <duration> (2 files)\n',
);
expect(result.stderr).toBe('');
});
Expand Down