Skip to content

Commit c311cf8

Browse files
authored
allow single-item arrays as a format (#2324)
1 parent ad7f17d commit c311cf8

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) on how to contribute to Cucumber.
99

1010
## [Unreleased]
11+
### Fixed
12+
- Allow single-item arrays as a format ([#2324](https://github.com/cucumber/cucumber-js/pull/2324))
1113

1214
## [9.5.0] - 2023-09-03
1315
### Added

src/api/convert_configuration_spec.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,39 @@ describe('convertConfiguration', () => {
3939
})
4040
})
4141

42-
it('should map multiple formatters with string and array notations', async () => {
42+
it('should map multiple formatters with string notation', async () => {
4343
const result = await convertConfiguration(
4444
{
4545
...DEFAULT_CONFIGURATION,
4646
format: [
4747
'summary',
4848
'message',
4949
'json:./report.json',
50+
'html:./report.html',
51+
],
52+
},
53+
{}
54+
)
55+
56+
expect(result.formats).to.eql({
57+
stdout: 'message',
58+
files: {
59+
'./report.html': 'html',
60+
'./report.json': 'json',
61+
},
62+
publish: false,
63+
options: {},
64+
})
65+
})
66+
67+
it('should map multiple formatters with array notation', async () => {
68+
const result = await convertConfiguration(
69+
{
70+
...DEFAULT_CONFIGURATION,
71+
format: [
72+
['summary'],
73+
['message'],
74+
['json', './report.json'],
5075
['html', './report.html'],
5176
],
5277
},

src/configuration/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FormatOptions } from '../formatter'
22
import { PickleOrder } from '../models/pickle_order'
33

4-
type FormatsConfiguration = Array<string | [string, string]>
4+
type FormatsConfiguration = Array<string | [string, string?]>
55

66
export interface IConfiguration {
77
backtrace: boolean

0 commit comments

Comments
 (0)