Skip to content

Commit

Permalink
Merge branch 'main' into fix-2178-format-option-splitter
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss authored Oct 1, 2023
2 parents 6d8182c + 89ec3b6 commit 1ad43ed
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 92 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ Please see [CONTRIBUTING.md](./CONTRIBUTING.md) on how to contribute to Cucumber

## [Unreleased]

## [9.5.1] - 2023-09-06
### Fixed
- Allow single-item arrays as a format ([#2324](https://github.com/cucumber/cucumber-js/pull/2324))

## [9.5.0] - 2023-09-03
### Added
- Support array notation of formats with path in configuration files ([#2318](https://github.com/cucumber/cucumber-js/pull/2318))

### Fixed
- Wait for stream to finish at end of publish plugin ([#2322](https://github.com/cucumber/cucumber-js/pull/2322))

## [9.4.0] - 2023-08-12
### Fixed
- Fix type import from cucumber-expressions ([#2310](https://github.com/cucumber/cucumber-js/pull/2310))
Expand Down Expand Up @@ -1521,7 +1532,9 @@ this.Given(), this.When(), this.Then() and this.defineStep() ([#2](https://githu

## 0.0.1

[Unreleased]: https://github.com/cucumber/cucumber-js/compare/v9.4.0...HEAD
[Unreleased]: https://github.com/cucumber/cucumber-js/compare/v9.5.1...HEAD
[9.5.1]: https://github.com/cucumber/cucumber-js/compare/v9.5.0...v9.5.1
[9.5.0]: https://github.com/cucumber/cucumber-js/compare/v9.4.0...v9.5.0
[9.4.0]: https://github.com/cucumber/cucumber-js/compare/v9.3.0...v9.4.0
[9.3.0]: https://github.com/cucumber/cucumber-js/compare/v9.2.0...v9.3.0
[9.2.0]: https://github.com/cucumber/cucumber-js/compare/v9.1.2...v9.2.0
Expand Down
10 changes: 5 additions & 5 deletions cucumber.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"require": ["features/**/*.ts"],
"format": [
"progress-bar",
"rerun:@rerun.txt",
"usage:reports/usage.txt",
"message:reports/messages.ndjson",
"junit:reports/junit.xml",
"html:reports/html-formatter.html"
["rerun", "@rerun.txt"],
["usage", "reports/usage.txt"],
["message", "reports/messages.ndjson"],
["junit", "reports/junit.xml"],
["html", "reports/html-formatter.html"]
],
"retry": 2,
"retryTagFilter": "@flaky"
Expand Down
15 changes: 6 additions & 9 deletions docs/formatters.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,19 @@ cucumber-js provides many built-in Formatters, plus building blocks with which y

You can specify one or more formats via the `format` configuration option:

- In a configuration file `{ format: ['<TYPE[:PATH]>'] }`
- On the CLI `$ cucumber-js --format <TYPE[:PATH]>`
- In a configuration file `{ format: ['progress-bar', ['html', 'cucumber-report.html']] }`
- On the CLI `$ cucumber-js --format progress-bar --format html:cucumber-report.html`

For each value you provide, `TYPE` should be one of:
For each format you specify, you have to provide one or two values. The first (required) is to identify the formatter. It can take a few forms:

* The name of one of the built-in formatters (below) e.g. `progress`
* The name of one of the built-in formatters (below) e.g. `progress-bar`
* A module/package name e.g. `@cucumber/pretty-formatter`
* A relative path to a local formatter implementation e.g. `./my-customer-formatter.js`
* An absolute path to a local formatter implementation in the form of a `file://` URL

If `PATH` is supplied, the formatter prints to the given file, otherwise it prints to `stdout`. If the path includes directories that do not yet exist they will be created.
Without a second value, the formatter will print to `stdout`. The second value, if present, is a path to where the formatter output should be written. If the path includes directories that do not yet exist, they will be created.

For example, this configuration would give you a progress bar as you run, plus JSON and HTML report files:

- In a configuration file `{ format: ['progress-bar', 'json:cucumber-report.json', 'html:cucumber-report.html'] }`
- On the CLI `$ cucumber-js --format progress-bar --format json:cucumber-report.json --format html:cucumber-report.html`
On the CLI, when specifying both a name and path, you'll need to use `:` as a delimiter. In a configuration file you can do this too, but you can also provide an array with the two values as separate strings, which is recommended.

Some notes on specifying Formatters:

Expand Down
126 changes: 56 additions & 70 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"gherkin",
"tests"
],
"version": "9.4.0",
"version": "9.5.1",
"homepage": "https://github.com/cucumber/cucumber-js",
"author": "Julien Biezemans <[email protected]>",
"contributors": [
Expand Down Expand Up @@ -246,7 +246,7 @@
"verror": "^1.10.0",
"xmlbuilder": "^15.1.1",
"yaml": "^2.2.2",
"yup": "^0.32.11"
"yup": "1.2.0"
},
"devDependencies": {
"@cucumber/compatibility-kit": "^12.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/api/convert_configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function convertFormats(
env: NodeJS.ProcessEnv
) {
const splitFormats: string[][] = flatConfiguration.format.map((item) =>
OptionSplitter.split(item)
Array.isArray(item) ? item : OptionSplitter.split(item)
)
return {
stdout:
Expand Down
Loading

0 comments on commit 1ad43ed

Please sign in to comment.