Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --quiet feature #131

Merged
merged 5 commits into from
Jul 7, 2016
Merged

add --quiet feature #131

merged 5 commits into from
Jul 7, 2016

Conversation

beatfreaker
Copy link
Contributor

Fix for #125

@sindresorhus
Copy link
Member

Can you add a test?

@beatfreaker
Copy link
Contributor Author

yup, doing that

and one more question does have to implement the same code in lintText function as well?

@sindresorhus
Copy link
Member

and one more question does have to implement the same code in lintText function as well?

Yes

@@ -64,7 +65,9 @@ function mergeReports(reports) {
function runEslint(paths, opts) {
var config = optionsManager.buildConfig(opts);
var engine = new eslint.CLIEngine(config);
return engine.executeOnFiles(paths, config);
var report = engine.executeOnFiles(paths, config);
report.results = opts.quiet ? eslint.CLIEngine.getErrorResults(report.results) : report.results;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new processReport(report, opts) function that contains this common code:

function processReport(report, opts) {
  report.results = ....
  return report;
}

@jamestalmage
Copy link
Contributor

LGTM

const filepath = await tempWrite('// TODO: quiet\nconsole.log()\n', 'x.js');

try {
await execa('../cli.js', ['--no-local', '--quiet', '--reporter=compact', filepath]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use t.throws here. It returns the error which you then can check.

https://github.com/avajs/ava#throwsfunctionpromise-error-message


test('quiet option', async t => {
const filepath = await tempWrite('// TODO: quiet\nconsole.log()\n', 'x.js');
var err = await t.throws(execa('../cli.js', ['--no-local', '--quiet', '--reporter=compact', filepath]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var => const

@sindresorhus sindresorhus merged commit bb76a2d into xojs:master Jul 7, 2016
@sindresorhus
Copy link
Member

👍 Awesome :)

@efegurkan efegurkan mentioned this pull request Aug 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants