From c04debd3d678548b6701fbbaa3a6a39039a2c1ed Mon Sep 17 00:00:00 2001 From: David Goss Date: Wed, 6 Sep 2023 08:11:37 +0100 Subject: [PATCH 1/2] allow single-item arrays as a format --- src/api/convert_configuration_spec.ts | 27 ++++++++++++++++++++++++++- src/configuration/types.ts | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/api/convert_configuration_spec.ts b/src/api/convert_configuration_spec.ts index 2cbe918b6..4ca25d26b 100644 --- a/src/api/convert_configuration_spec.ts +++ b/src/api/convert_configuration_spec.ts @@ -39,7 +39,7 @@ describe('convertConfiguration', () => { }) }) - it('should map multiple formatters with string and array notations', async () => { + it('should map multiple formatters with string notation', async () => { const result = await convertConfiguration( { ...DEFAULT_CONFIGURATION, @@ -47,6 +47,31 @@ describe('convertConfiguration', () => { 'summary', 'message', 'json:./report.json', + 'html:./report.html', + ], + }, + {} + ) + + expect(result.formats).to.eql({ + stdout: 'message', + files: { + './report.html': 'html', + './report.json': 'json', + }, + publish: false, + options: {}, + }) + }) + + it('should map multiple formatters with array notation', async () => { + const result = await convertConfiguration( + { + ...DEFAULT_CONFIGURATION, + format: [ + ['summary'], + ['message'], + ['json', './report.json'], ['html', './report.html'], ], }, diff --git a/src/configuration/types.ts b/src/configuration/types.ts index ad43d96f9..8310ec75c 100644 --- a/src/configuration/types.ts +++ b/src/configuration/types.ts @@ -1,7 +1,7 @@ import { FormatOptions } from '../formatter' import { PickleOrder } from '../models/pickle_order' -type FormatsConfiguration = Array +type FormatsConfiguration = Array export interface IConfiguration { backtrace: boolean From ede5eb6ab93e5f616cfc9fd88fa63b92dae6dce2 Mon Sep 17 00:00:00 2001 From: David Goss Date: Wed, 6 Sep 2023 08:18:22 +0100 Subject: [PATCH 2/2] update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d8c77c79..3f11f1c77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). Please see [CONTRIBUTING.md](./CONTRIBUTING.md) on how to contribute to Cucumber. ## [Unreleased] +### Fixed +- Allow single-item arrays as a format ([#2324](https://github.com/cucumber/cucumber-js/pull/2324)) ## [9.5.0] - 2023-09-03 ### Added