You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*`pretty` formatter has been removed. All errors are now reported in a `pretty` format instead. Use the `progress-bar` or `progress` formats instead.
4
+
*`pretty` formatter has been removed. All errors are now reported in a `pretty` format instead. The `progress` formatter is now the default.
5
+
* Major changes to custom formatters API due to rewrite in support of event protocol. Please see the updated documentation.
6
+
* Remove `registerHandler` and `registerListener`. Use `BeforeAll` / `AfterAll` for setup code. Use the event protocol formatter if used for reporting. Please open an issue if you have another use case.
5
7
6
8
#### New Features
7
9
8
10
* Add `--i18n-languages` and `--i18n-keywords <ISO 639-1>` CLI options
9
-
* Add `BeforeAll` / `AfterAll` hooks to replace uses of `registerHandler`
11
+
* Add `BeforeAll` / `AfterAll` hooks for suite level setup / teardown
Copy file name to clipboardExpand all lines: docs/cli.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,8 @@ The executable is also aliased as `cucumber-js` and `cucumberjs`.
12
12
The latter is causing the operating system to invoke JScript instead of Node.js,
13
13
because of the file extension.
14
14
15
-
**Note on global installs:** Cucumber does not work when installed globally because cucumber
16
-
needs to be required in your support files and globally installed modules cannot be required.
15
+
**Note on global installs:** Cucumber does not work when installed globally because cucumber
16
+
needs to be required in your support files and globally installed modules cannot be required.
17
17
18
18
## Running specific features
19
19
@@ -47,12 +47,12 @@ This option may be used multiple times in order to output different formats to d
47
47
If multiple formats are specified with the same output, only the last is used.
48
48
49
49
Built-in formatters
50
+
* event-protocol - prints the event protocl. See [current docs](https://docs.cucumber.io/event-protocol/) and the [proposed updates](https://github.com/cucumber/cucumber/pull/172) which were implemented.
50
51
* json - prints the feature as JSON
51
-
* pretty - prints the feature as is (default)
52
-
* progress - prints one character per scenario
52
+
* progress - prints one character per scenario (default)
53
53
* progress-bar - prints a progress bar and outputs errors/warnings along the way
54
54
* rerun - prints the paths of any non passing scenarios ([example](/features/rerun_formatter.feature))
55
-
* suggested use: add the rerun formatter to your default profile and the output file to your `.gitignore`.
55
+
* suggested use: add the rerun formatter to your default profile and the output file to your `.gitignore`.
56
56
* After a failed run, remove any arguments used for selecting feature files and add the rerun file in order to rerun just failed scenarios. The rerun file must start with `@` sign in order for cucumber to parse it as a rerun file instead of a feature file.
57
57
* Use with `--fail-fast` to rerun the failure and the remaining features.
58
58
* snippets - prints just the code snippets for undefined steps
Copy file name to clipboardExpand all lines: docs/custom_formatters.md
+5-3
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,16 @@
1
1
# Custom Formatters
2
2
3
-
Custom formatters should be a javascript class. The constructor will be an options object which is the options defined with `--format-options` and the following:
3
+
Custom formatters should be a javascript class. The constructor will be an options object which is the options defined with `--format-options` and the following:
4
4
5
5
*`colorFns`: a series of helper functions for outputting colors. See [here](/src/formatter/get_color_fns.js). Respects `colorsEnabled` option
6
6
*`cwd`: the current working directory
7
+
*`eventBroadcaster`: an event emitter that emits the event protocol (which is still being defined). See [current docs](https://docs.cucumber.io/event-protocol/) and the [proposed updates](https://github.com/cucumber/cucumber/pull/172) which were implemented.
8
+
*`eventDataCollector`: an instance of [EventDataCollector](/src/formatter/helpers/event_data_collector.js) which handles the complexity of grouping the data for related events
7
9
*`log`: function which will write the passed string to the the designated stream (stdout or the to file the formatter output is being redirected to).
8
-
*`snippetBuilder`: an object with a `build` method that should be called with a [step](/src/models/step.js)to get the snippet for an undefined step
10
+
*`snippetBuilder`: an object with a `build` method that should be called with `{keywordType, pickleStep}`. The `pickleStep` can be retrieved with the `eventDataCollector` while the `keywordType` is complex to compute (see the [SnippetsFormatter](/src/formatter/snippets_formatter.js) for an example).
9
11
*`stream`: the underlying stream the formatter is writing to. `log` is a shortcut for writing to it.
10
12
11
-
Custom formatters should then define instance methods in order to output something during a particular event. For example it should define a `handleBeforeFeatures` function in order to output something as cucumber is starting.
13
+
The constructor of custom formatters should add listeners to the `eventBroadcaster`.
12
14
13
15
See a couple examples [here](/features/custom_formatter.feature) and the built in formatters [here](/src/formatter)
{"type":"source","uri":"features/a.feature","data":"Feature: a feature\n Scenario: a scenario\n Given a step","media":{"encoding":"utf-8","type":"text/vnd.cucumber.gherkin+plain"}}
{"type":"test-step-finished","index":0,"result":{"duration":0,"exception":"Error: my error\n at World.<anonymous> (features/step_definitions/steps.js:4:51)","status":"failed"},"testCase":{"sourceLocation":{"uri":"features/a.feature","line":2}}}
{"type":"source","uri":"features/a.feature","data":"Feature: a feature\n Scenario: a scenario\n Given a step\n Examples:\n | a | b |","media":{"encoding":"utf-8","type":"text/vnd.cucumber.gherkin+plain"}}
{"type":"source","uri":"features/a.feature","data":"Feature: a feature\n Scenario: a scenario\n Given a step","media":{"encoding":"utf-8","type":"text/vnd.cucumber.gherkin+plain"}}
0 commit comments