Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) on how to contribute to Cucumber.

## [Unreleased]
### Added
- Allow loading config files in TypeScript format ([#2709](https://github.com/cucumber/cucumber-js/pull/2709))

### Changed
- Compress report content with gzip before publishing ([#2687](https://github.com/cucumber/cucumber-js/pull/2687))

Expand Down
15 changes: 11 additions & 4 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,18 @@ module.exports = {

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

### Type checking
### TypeScript

If you want to type check your configuration, we export two types that can help with that:
- `IProfiles` represents the dictionary of profile names to configuration objects exported for CommonJS
- `IConfiguration` represents a single configuration object exported with named exports for ESM (`Partial<IConfiguration>` will be more useful in practise)
You can also write your configuration file in TypeScript, with a `.ts`, `.mts` or `.cts` extension. These files are loaded with [Node.js built-in TypeScript support](https://nodejs.org/api/typescript.html), which has several caveats and limitations, mostly that your `tsconfig.json` won't be honoured and that you need to be explicit about type imports. Here's an example:

```typescript
import type { IConfiguration } from '@cucumber/cucumber'

export default {
parallel: 2,
format: ['html:cucumber-report.html']
} satisfies Partial<IConfiguration>
```

## Options

Expand Down
50 changes: 35 additions & 15 deletions package-lock.json

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

Loading