Skip to content

Commit df1511a

Browse files
feat: output info messages ("Reformatted x with y") to stdout instead of stderr (hallettj#52)
1 parent 53337d9 commit df1511a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

git-format-staged

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ VERSION = '$VERSION'
2727
PROG = sys.argv[0]
2828

2929
def info(msg):
30-
print(msg, file=sys.stderr)
30+
print(msg, file=sys.stdout)
3131

3232
def warn(msg):
3333
print('{}: warning: {}'.format(PROG, msg), file=sys.stderr)

test/git-format-staged_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ test('displays a message if a file was changed', async t => {
252252
`
253253
)
254254
await stage(r, 'index.js')
255-
const { stderr } = await formatStaged(r, '-f prettier-standard *.js')
256-
t.regex(stderr, /Reformatted index\.js with prettier-standard/)
255+
const { stdout } = await formatStaged(r, '-f prettier-standard *.js')
256+
t.regex(stdout, /Reformatted index\.js with prettier-standard/)
257257
})
258258

259259
test('does not display a message if formatting did not produce any changes', async t => {

0 commit comments

Comments
 (0)