Skip to content

Commit aac018c

Browse files
authored
Export configuration types (#2598)
1 parent 085373b commit aac018c

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
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+
### Added
12+
- Export configuration types ([#2598](https://github.com/cucumber/cucumber-js/pull/2598))
1113

1214
## [12.1.0] - 2025-07-19
1315
### Added

docs/configuration.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ module.exports = {
7171

7272
(If you're wondering why the configuration sits within a "default" property, that's to allow for [Profiles](./profiles.md).)
7373

74+
### Type checking
75+
76+
If you want to type check your configuration, we export two types that can help with that:
77+
- `IProfiles` represents the dictionary of profile names to configuration objects exported for CommonJS
78+
- `IConfiguration` represents a single configuration object exported with named exports for ESM (`Partial<IConfiguration>` will be more useful in practise)
79+
7480
## Options
7581

7682
These options can be used in a configuration file (see [above](#files)) or on the [CLI](./cli.md), or both.

exports/root/report.api.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,31 @@ declare namespace GherkinDocumentParser {
203203
// @public (undocumented)
204204
export const Given: IDefineStep_2;
205205

206+
// @public
207+
export interface IConfiguration {
208+
backtrace: boolean;
209+
dryRun: boolean;
210+
failFast: boolean;
211+
forceExit: boolean;
212+
format: Array<string | [string, string?]>;
213+
formatOptions: JsonObject;
214+
import: string[];
215+
language: string;
216+
loader: string[];
217+
name: string[];
218+
order: IPickleOrder;
219+
parallel: number;
220+
paths: string[];
221+
publish: boolean;
222+
require: string[];
223+
requireModule: string[];
224+
retry: number;
225+
retryTagFilter: string;
226+
strict: boolean;
227+
tags: string;
228+
worldParameters: JsonObject;
229+
}
230+
206231
// @public (undocumented)
207232
export interface IContext<ParametersType = any> {
208233
// (undocumented)
@@ -257,6 +282,9 @@ interface IGetStepKeywordRequest {
257282
pickleStep: messages.PickleStep;
258283
}
259284

285+
// @public
286+
export type IProfiles = Record<string, Partial<IConfiguration>>;
287+
260288
// @public (undocumented)
261289
function isFailure(result: messages.TestStepResult, willBeRetried?: boolean): boolean;
262290

src/configuration/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,9 @@ export interface IConfiguration {
146146
*/
147147
worldParameters: JsonObject
148148
}
149+
150+
/**
151+
* Collection of named configuration profiles
152+
* @public
153+
*/
154+
export type IProfiles = Record<string, Partial<IConfiguration>>

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import { version as _version } from './version'
1818
// type version as string to avoid tripping api-extractor every release
1919
export const version = _version as string
2020

21+
// Configuration
22+
export { IConfiguration, IProfiles } from './configuration'
23+
2124
// Top level
2225
export { default as supportCodeLibraryBuilder } from './support_code_library_builder'
2326
export { default as DataTable } from './models/data_table'

0 commit comments

Comments
 (0)