-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
cucumber-js --help should list available formatters #1700
Comments
The code for defining and describing the CLI options via the commander library is here: https://github.com/cucumber/cucumber-js/blob/main/src/cli/argv_parser.ts |
Hey @aslakhellesoy , I'd like to help out with this issue. |
Hi @TomerPacific excellent! What questions do you have about getting started? |
@aslakhellesoy, sorry for the late reply. |
@aslakhellesoy , I've got the project up and running and I looked at all the relevant places mentioned in this issue. Regarding the formatters, you are referencing this line from argv_parser.ts:
And it should return all available formatters like in here: : Outputs HTML report
json : Prints the feature as JSON.
The JSON format is in maintenance mode.
Please consider using the message formatter
with the standalone json-formatter
(https://github.com/cucumber/cucumber/tree/master/json-formatter).
junit : Generates a report similar to Ant+JUnit. Use
junit,fileattribute=true to include a file attribute.
message : Outputs protobuf messages
pretty : Prints the feature as is - in colours.
progress : Prints one character per scenario.
rerun : Prints failing files with line numbers.
stepdefs : Prints All step definitions with their locations. Same as
the usage formatter, except that steps are not printed.
summary : Summary output of feature and scenarios
usage : Prints where step definitions are used.
The slowest step definitions (with duration) are
listed first. If --dry-run is used the duration
is not shown, and step definitions are sorted by
filename instead.
Use --format rerun --out rerun.txt to write out failing
features. You can rerun them with cucumber @rerun.txt.
FORMAT can also be the fully qualified class name of
your own custom formatter. If the class isn't loaded,
Cucumber will attempt to require a file with a relative
file name that is the underscore name of the class name.
Example: --format Foo::BarZap -> Cucumber will look for
foo/bar_zap.rb. You can place the file with this relative
path underneath your features/support directory or anywhere
on Ruby's LOAD_PATH, for example in a Ruby gem. My question is if there is a programmatic way to get all the formatters (so that it will adapt to future changes) or if this should be done in another way? |
As far as I know, no, there is no programmatic way to get formatters |
I have done the following in argv_parser.ts:
I don't know if this is the desired addition you were looking for. `7) Configuration
Taking this test as an example, I think that because there were not formatters before, this test only expected one formatter and now there are more and that is why the test is failing. Should I change the tests accordingly or am I missing something? |
There is a list of the available formatters in cucumber-js/src/formatter/builder.ts Lines 65 to 84 in 6e958f1
I would suggest refactoring that case statement to a Then the The list could be passed to commander's option As for getting the long textual description of what each formatter does - it would be nice if each |
@TomerPacific it would be easier if you open a pull request with your changes |
Here is the output from 7.3.0:
For comparison, cucumber-ruby lists the available formatters:
The text was updated successfully, but these errors were encountered: