From 0b2ab7d4d0a144b6dc0ca271e1a6e8ebcc0f9dfe Mon Sep 17 00:00:00 2001 From: Aleks Hudochenkov Date: Thu, 16 Sep 2021 22:00:36 +0200 Subject: [PATCH] Further improvement for `quite` option in API #4476 --- docs/user-guide/usage/options.md | 6 ++++++ lib/__tests__/cli.test.js | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/docs/user-guide/usage/options.md b/docs/user-guide/usage/options.md index 348bf39699..cc19c9e67b 100644 --- a/docs/user-guide/usage/options.md +++ b/docs/user-guide/usage/options.md @@ -187,3 +187,9 @@ CLI flag: `--stdin-filename` A filename to assign the input. If using `code` or `stdin` to pass a source string directly, you can use `codeFilename` to associate that code with a particular filename. + +## `quiet` + +CLI flag: `--quiet` + +Only register violations for rules with an "error"-level severity (ignore "warning"-level). diff --git a/lib/__tests__/cli.test.js b/lib/__tests__/cli.test.js index 7ba07ac993..263cc1b015 100644 --- a/lib/__tests__/cli.test.js +++ b/lib/__tests__/cli.test.js @@ -320,4 +320,17 @@ describe('CLI', () => { 'Max warnings exceeded: 1 found. 0 allowed', ); }); + + it('--quiet', async () => { + await cli([ + '--quiet', + '--config', + fixturesPath('default-severity-warning.json'), + fixturesPath('empty-block.css'), + ]); + + expect(process.exitCode).toEqual(2); + + expect(process.stdout.write).toHaveBeenCalledTimes(0); + }); });