Skip to content

Commit

Permalink
feat: output info messages ("Reformatted x with y") to stdout instead…
Browse files Browse the repository at this point in the history
… of stderr (#52)
  • Loading branch information
HassanEskandari committed Mar 20, 2022
1 parent 53337d9 commit df1511a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion git-format-staged
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ VERSION = '$VERSION'
PROG = sys.argv[0]

def info(msg):
print(msg, file=sys.stderr)
print(msg, file=sys.stdout)

def warn(msg):
print('{}: warning: {}'.format(PROG, msg), file=sys.stderr)
Expand Down
4 changes: 2 additions & 2 deletions test/git-format-staged_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ test('displays a message if a file was changed', async t => {
`
)
await stage(r, 'index.js')
const { stderr } = await formatStaged(r, '-f prettier-standard *.js')
t.regex(stderr, /Reformatted index\.js with prettier-standard/)
const { stdout } = await formatStaged(r, '-f prettier-standard *.js')
t.regex(stdout, /Reformatted index\.js with prettier-standard/)
})

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

0 comments on commit df1511a

Please sign in to comment.