Skip to content

Commit

Permalink
Honor --quiet flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 committed Sep 9, 2020
1 parent 8f07cae commit 08b15d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ prog
'a glob of files to to test the EcmaScript version against'
)
.option('--module', 'use ES modules')
.option('--quiet', 'Quiet mode - only displays warn and error messages')
.option('--allow-hash-bang', 'if the code starts with #! treat it as a comment')
.option('--not', 'folder or file names to skip', prog.LIST)
.action((args, options, logger) => {
Expand Down Expand Up @@ -78,7 +79,6 @@ prog
'No files were passed in please pass in a list of files to es-check!'
)
process.exit(1)

}

/**
Expand Down Expand Up @@ -200,7 +200,9 @@ prog
})
process.exit(1)
}
logger.error(`ES-Check: there were no ES version matching errors! 🎉`)
if (!options.quiet) {
logger.error(`ES-Check: there were no ES version matching errors! 🎉`)
}
})

prog.parse(argsArray)
9 changes: 9 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,12 @@ it('👌 Es Check skips versions included in the not flag', (done) => {
done()
});
});

it('🎉 Es Check does not output anything in --quiet mode', (done) => {
exec('node index.js --quiet es5 ./tests/es5.js', (err, stdout, stderr) => {
assert.equal(err, null)
assert.equal(stdout, '')
assert.equal(stderr, '')
done()
})
})

0 comments on commit 08b15d4

Please sign in to comment.