Skip to content

Commit 12aaa96

Browse files
committed
tests: add no-args help test
1 parent 0005910 commit 12aaa96

File tree

4 files changed

+158
-0
lines changed

4 files changed

+158
-0
lines changed

package-lock.json

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
"ansi-escapes": "^4.2.0",
118118
"cli-table": "^0.3.1",
119119
"command-line-args": "^5.1.1",
120+
"command-line-usage": "^6.0.2",
120121
"import-local": "^3.0.1",
121122
"terser-webpack-plugin": "^1.3.0",
122123
"update-notifier": "^3.0.1",
@@ -145,6 +146,7 @@
145146
"jest": "^24.8.0",
146147
"jest-cli": "^24.8.0",
147148
"jest-junit": "^6.4.0",
149+
"jest-serializer-ansi": "^1.0.3",
148150
"lerna": "^3.15.0",
149151
"lint-staged": "^9.2.0",
150152
"nyc": "^14.1.1",
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`help-no-args 1`] = `
4+
"
5+
⬡ webpack ⬡
6+
7+
https://webpack.js.org
8+
9+
The build tool for modern web applications
10+
11+
Usage: \`webpack [...options] | <command>\`
12+
13+
Example: \`webpack help --flag | <command>\`
14+
15+
16+
17+
Available Commands
18+
19+
create Initialize a new webpack configuration
20+
migrate Migrate a configuration to a new version
21+
loader Scaffold a loader repository
22+
plugin Scaffold a plugin repository
23+
info Outputs information about your system and dependencies
24+
25+
Options
26+
27+
--entry string The entry point of your application
28+
-c, --config string Provide path to a webpack configuration file
29+
-r, --register string[] Preload one or more modules before loading the
30+
webpack configuration
31+
-m, --merge string Merge a configuration file
32+
--progress string Print compilation progress during build
33+
--color Enables/Disables colors on the console
34+
--help Outputs list of supported flags
35+
-o, --output string Output location of the file generated by webpack
36+
-g, --global string[] Declares and exposes a global variable
37+
-t, --target string Sets the build target
38+
-w, --watch Watch for files changes
39+
-h, --hot Enables Hot Module Replacement
40+
--debug Switch loaders to debug mode
41+
-s, --sourcemap string Determine source maps to use
42+
--prefetch string[] Prefetch this request
43+
-j, --json Prints result as JSON
44+
-d, --dev Run development build
45+
-p, --prod Run production build
46+
--version Get current version
47+
48+
49+
Made with ♥️ by the webpack team
50+
"
51+
`;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
const { run } = require('../../../testUtils');
4+
const serializer = require('jest-serializer-ansi');
5+
6+
test('help-no-args', () => {
7+
const { stdout, stderr } = run(__dirname, ['--help']);
8+
expect.addSnapshotSerializer(serializer);
9+
expect(stdout).toMatchSnapshot();
10+
expect(stderr).toHaveLength(0);
11+
});

0 commit comments

Comments
 (0)