Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Honor --quiet flag #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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()
})
})