diff --git a/src/cli/__snapshots__/htmlhint.spec.js.snap b/src/cli/__snapshots__/htmlhint.spec.js.snap
new file mode 100644
index 000000000..10aa1af97
--- /dev/null
+++ b/src/cli/__snapshots__/htmlhint.spec.js.snap
@@ -0,0 +1,67 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Executable should print help with --help: stderr 1`] = `""`;
+
+exports[`Executable should print help with --help: stdout 1`] = `
+"Usage: htmlhint [options]
+
+Options:
+ -V, --version output the version number
+ -l, --list show all of the rules available
+ -c, --config custom configuration file
+ -r, --rules set all of the rules available
+ -R, --rulesdir load custom rules from file or folder
+ -f, --format output messages as custom format
+ -i, --ignore add pattern to exclude matches
+ --nocolor disable color
+ --warn Warn only, exit with 0
+ -h, --help display help for command
+ Examples:
+
+ htmlhint
+ htmlhint www
+ htmlhint www/test.html
+ htmlhint www/**/*.xhtml
+ htmlhint www/**/*.{htm,html}
+ htmlhint http://www.alibaba.com/
+ cat test.html | htmlhint stdin
+ htmlhint --list
+ htmlhint --rules tag-pair,id-class-value=underline test.html
+ htmlhint --config .htmlhintrc test.html
+ htmlhint --ignore **/build/**,**/test/**
+ htmlhint --rulesdir ./rules/
+"
+`;
+
+exports[`Executable should print help with -h: stderr 1`] = `""`;
+
+exports[`Executable should print help with -h: stdout 1`] = `
+"Usage: htmlhint [options]
+
+Options:
+ -V, --version output the version number
+ -l, --list show all of the rules available
+ -c, --config custom configuration file
+ -r, --rules set all of the rules available
+ -R, --rulesdir load custom rules from file or folder
+ -f, --format output messages as custom format
+ -i, --ignore add pattern to exclude matches
+ --nocolor disable color
+ --warn Warn only, exit with 0
+ -h, --help display help for command
+ Examples:
+
+ htmlhint
+ htmlhint www
+ htmlhint www/test.html
+ htmlhint www/**/*.xhtml
+ htmlhint www/**/*.{htm,html}
+ htmlhint http://www.alibaba.com/
+ cat test.html | htmlhint stdin
+ htmlhint --list
+ htmlhint --rules tag-pair,id-class-value=underline test.html
+ htmlhint --config .htmlhintrc test.html
+ htmlhint --ignore **/build/**,**/test/**
+ htmlhint --rulesdir ./rules/
+"
+`;
diff --git a/src/cli/htmlhint.spec.js b/src/cli/htmlhint.spec.js
index 7d9335d3e..94a555d95 100644
--- a/src/cli/htmlhint.spec.js
+++ b/src/cli/htmlhint.spec.js
@@ -36,26 +36,21 @@ describe('Executable', () => {
})
})
- for (const format of [
- 'checkstyle',
- 'compact',
- 'default',
- 'html',
- 'json',
- 'junit',
- 'markdown',
- 'unix',
- ]) {
- it(`should have stdout output with formatter ${format}`, async () => {
- const { exitCode, stdout, stderr } = await run(__dirname, [
- path.resolve(__dirname, '__fixtures__', 'executable.html'),
- '--format',
- format,
- ])
-
- expect(exitCode).toBe(1)
- expect(stdout).not.toBe('')
- expect(stderr).toBe('')
- })
- }
+ it(`should print help with --help`, async () => {
+ const { exitCode, stdout, stderr } = await run(__dirname, ['--help'])
+
+ expect(exitCode).toBe(0)
+ expect(stdout).toMatchSnapshot('stdout')
+
+ expect(stderr).toMatchSnapshot('stderr')
+ })
+
+ it(`should print help with -h`, async () => {
+ const { exitCode, stdout, stderr } = await run(__dirname, ['-h'])
+
+ expect(exitCode).toBe(0)
+ expect(stdout).toMatchSnapshot('stdout')
+
+ expect(stderr).toMatchSnapshot('stderr')
+ })
})