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

fix(cli): restore command line help contents #3502

Merged
merged 1 commit into from
May 7, 2020

Conversation

devoto13
Copy link
Collaborator

@devoto13 devoto13 commented May 7, 2020

These were lost after migration to yargs as CLI parser.

The only issue I've noticed is that yargs reports all unknown arguments in the error about unknown command, but I guess we can live with it for now:

$ karma bla bla bla

...

Unknown commands: bla, bla, bla

Fixes #3474

These were lost after migration to yargs as CLI parser.

Fixes karma-runner#3474
@devoto13
Copy link
Collaborator Author

devoto13 commented May 7, 2020

Below are diffs against output of Karma 4.4.1. Most notable difference is that yargs now wraps output at 80 characters. It is configurable, but I think we should stay wit the default as a good practice.

$ karma --help

 Karma - Spectacular Test Runner for JavaScript.

+Run --help with particular command to see its description and available options.
+
 Usage:
   karma <command>

 Commands:
-  start [<configFile>] [<options>] Start the server / do single run.
-  init [<configFile>] Initialize a config file.
-  run [<options>] [ -- <clientArgs>] Trigger a test run.
-  completion Shell completion for karma.
-
-Run --help with particular command to see its description and available options.
+  karma init        Initialize a config file.
+  karma start       Start the server / do a single run.
+  karma run         Trigger a test run.
+  karma stop        Stop the server.
+  karma completion  Shell completion for karma.

 Options:
-  --help     Print usage and options.
-  --version  Print current version.
-
+  --help     Print usage and options.                                  [boolean]
+  --version  Print current version.                                    [boolean]

$ karma init --help

 Karma - Spectacular Test Runner for JavaScript.

 INIT - Initialize a config file.

 Usage:
-  karma init [<configFile>]
+  karma init [configFile]

 Options:
+  --help       Print usage and options.                                [boolean]
   --log-level  <disable | error | warn | info | debug> Level of logging.
   --colors     Use colors when reporting and printing logs.
   --no-colors  Do not use colors when reporting or printing logs.
-  --help       Print usage and options.
-

$ karma start --help

 Karma - Spectacular Test Runner for JavaScript.

 START - Start the server / do a single run.

 Usage:
-  karma start [<configFile>] [<options>]
+  karma start [configFile]

 Options:
+  --help                           Print usage and options.            [boolean]
   --port                           <integer> Port where the server is running.
   --auto-watch                     Auto watch source files and run on change.
   --detached                       Detach the server.
   --no-auto-watch                  Do not watch source files.
-  --log-level                      <disable | error | warn | info | debug> Level of logging.
+  --log-level                      <disable | error | warn | info | debug> Level
+                                   of logging.
   --colors                         Use colors when reporting and printing logs.
-  --no-colors                      Do not use colors when reporting or printing logs.
-  --reporters                      List of reporters (available: dots, progress, junit, growl, coverage).
-  --browsers                       List of browsers to start (eg. --browsers Chrome,ChromeCanary,Firefox).
-  --capture-timeout                <integer> Kill browser if does not capture in given time [ms].
+  --no-colors                      Do not use colors when reporting or printing
+                                   logs.
+  --reporters                      List of reporters (available: dots, progress,
+                                   junit, growl, coverage).
+  --browsers                       List of browsers to start (eg. --browsers
+                                   Chrome,ChromeCanary,Firefox).
+  --capture-timeout                <integer> Kill browser if does not capture in
+                                   given time [ms].
   --single-run                     Run the test when browsers captured and exit.
   --no-single-run                  Disable single-run.
-  --report-slower-than             <integer> Report tests that are slower than given time [ms].
+  --report-slower-than             <integer> Report tests that are slower than
+                                   given time [ms].
   --fail-on-empty-test-suite       Fail on empty test suite.
   --no-fail-on-empty-test-suite    Do not fail on empty test suite.
   --fail-on-failing-test-suite     Fail on failing test suite.
   --no-fail-on-failing-test-suite  Do not fail on failing test suite.
-  --help                           Print usage and options.
-

$ karma run --help

 Karma - Spectacular Test Runner for JavaScript.

 RUN - Run the tests (requires running server).

 Usage:
-  karma run [<configFile>] [<options>] [ -- <clientArgs>]
+  karma run [configFile] [-- <clientArgs>]

 Options:
+  --help                         Print usage and options.              [boolean]
   --port                         <integer> Port where the server is listening.
   --no-refresh                   Do not re-glob all the patterns.
   --fail-on-empty-test-suite     Fail on empty test suite.
   --no-fail-on-empty-test-suite  Do not fail on empty test suite.
-  --help                         Print usage.
-  --log-level                    <disable | error | warn | info | debug> Level of logging.
+  --log-level                    <disable | error | warn | info | debug> Level
+                                 of logging.
   --colors                       Use colors when reporting and printing logs.
-  --no-colors                    Do not use colors when reporting or printing logs.
-
+  --no-colors                    Do not use colors when reporting or printing
+                                 logs.

$ karma stop --help

 Karma - Spectacular Test Runner for JavaScript.

 STOP - Stop the server (requires running server).

 Usage:
-  karma run [<configFile>] [<options>]
+  karma stop [configFile]

 Options:
+  --help       Print usage and options.                                [boolean]
   --port       <integer> Port where the server is listening.
   --log-level  <disable | error | warn | info | debug> Level of logging.
-  --help       Print usage.
-

$ karma completion --help

 Karma - Spectacular Test Runner for JavaScript.

 COMPLETION - Bash/ZSH completion for karma.

 Installation:
   karma completion >> ~/.bashrc

-
 Options:
-  --help  Print usage.
-
+  --help  Print usage and options.                                     [boolean]

$ karma --version

- Karma version: 4.4.1
+ 5.0.4

@karmarunnerbot
Copy link
Member

Build karma 258 completed (commit a60214e794 by @devoto13)

@karmarunnerbot
Copy link
Member

Build karma 259 completed (commit a60214e794 by @devoto13)

@devoto13 devoto13 requested a review from johnjbarton May 7, 2020 17:29
Copy link
Contributor

@johnjbarton johnjbarton left a comment

Choose a reason for hiding this comment

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

Thanks for the test! Answered my question: "how did this happen" ;-)

@johnjbarton johnjbarton merged commit e99da31 into karma-runner:master May 7, 2020
karmarunnerbot pushed a commit that referenced this pull request May 7, 2020
## [5.0.5](v5.0.4...v5.0.5) (2020-05-07)

### Bug Fixes

* **cli:** restore command line help contents ([#3502](#3502)) ([e99da31](e99da31)), closes [#3474](#3474)
@karmarunnerbot
Copy link
Member

🎉 This PR is included in version 5.0.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@devoto13 devoto13 deleted the fix-cli-help branch May 7, 2020 18:19
anthony-redFox pushed a commit to anthony-redFox/karma that referenced this pull request May 16, 2023
These were lost after migration to yargs as CLI parser.

Fixes karma-runner#3474
anthony-redFox pushed a commit to anthony-redFox/karma that referenced this pull request May 16, 2023
## [5.0.5](karma-runner/karma@v5.0.4...v5.0.5) (2020-05-07)

### Bug Fixes

* **cli:** restore command line help contents ([karma-runner#3502](karma-runner#3502)) ([e99da31](karma-runner@e99da31)), closes [karma-runner#3474](karma-runner#3474)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command-line help not working
3 participants