Skip to content

Commit

Permalink
deprecation updates ahead of 9.0.0 (#2240)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss authored Feb 17, 2023
1 parent 90ebb80 commit 9fbdd82
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
18 changes: 6 additions & 12 deletions docs/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,37 @@ Assuming a current major version of `N`:
2. Later, a major version (e.g. `N+1.0.0`) is released; the deprecation is highlighted in the release notes
3. Later still, another major version (e.g. `N+2.0.0`) is released with the deprecated functionality removed

In some cases, we might wait longer than `N+2.0.0` before removing functionality if the ecosystem needs more time to adapt.

## Current deprecations

### `Cli`

Deprecated in `8.7.0`, will be removed in `10.0.0`.
Deprecated in `8.7.0`, will be removed in `10.0.0` or later.

The `Cli` class is used internally to represent an instance of the command-line program invoked via `cucumber-js`. It can be used to run Cucumber programmatically, but is poorly suited for this.

To adapt, pivot to the `runCucumber` function from the [JavaScript API](./javascript_api.md), or raise an issue if you feel your use case isn't catered for.

### `defineStep`

Deprecated in `8.3.0`, will be removed in `10.0.0`.

`defineStep` is a way to generically define a step without tying it to any of the `Given`, `When` or `Then` keywords. This leads to ambiguity in the business language and is considered an antipattern; steps should be clearly applicable to one of those keywords, being a context, action or outcome respectively.

To adapt, review your steps and define them with the appropriate keyword, or just switch to `Given` as a starting point. We're working on adding [an opt-in "strict mode" for keywords](https://github.com/cucumber/cucumber-js/issues/2043) which will yield an error when the keyword in the Gherkin text doesn't match that of the step definition, and could be used to pinpoint such issues in your project.

### `parseGherkinMessageStream`

Deprecated in `8.0.0`, will be removed in `10.0.0`.
Deprecated in `8.0.0`, will be removed in `10.0.0` or later.

`parseGherkinMessageStream` is a way to process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids. Its interface includes internal implementation details from Cucumber which are difficult to assemble.

To adapt, pivot to the `loadSources` function from the [JavaScript API](./javascript_api.md), or raise an issue if you feel your use case isn't catered for.

### `PickleFilter`

Deprecated in `8.7.0`, will be removed in `10.0.0`.
Deprecated in `8.7.0`, will be removed in `10.0.0` or later.

The `PickleFilter` class is used to provide a filter to the `parseGherkinMessageStream` function above.

To adapt, pivot to the `loadSources` function from the [JavaScript API](./javascript_api.md), or raise an issue if you feel your use case isn't catered for.

### `Runtime`

Deprecated in `8.7.0`, will be removed in `10.0.0`.
Deprecated in `8.7.0`, will be removed in `10.0.0` or later.

The `Runtime` class is used internally to represent an instance of the serial test case runner. Its interface includes internal implementation details from Cucumber which are difficult to assemble.

Expand Down
10 changes: 2 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const AfterStep = methods.AfterStep
export const Before = methods.Before
export const BeforeAll = methods.BeforeAll
export const BeforeStep = methods.BeforeStep
export const defineStep = methods.defineStep
export const defineParameterType = methods.defineParameterType
export const Given = methods.Given
export const setDefaultTimeout = methods.setDefaultTimeout
Expand Down Expand Up @@ -66,13 +67,6 @@ export const Cli = deprecate(
_Cli,
'`Cli` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'
)
/**
* @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
*/
export const defineStep = deprecate(
methods.defineStep,
'`defineStep` is deprecated, use `Given`, `When` or `Then` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'
)
/**
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
*/
Expand All @@ -88,7 +82,7 @@ export const PickleFilter = deprecate(
'`PickleFilter` is deprecated, use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'
)
/**
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
* @deprecated use `runCucumber` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
*/
export const Runtime = deprecate(
_Runtime,
Expand Down
2 changes: 1 addition & 1 deletion src/wrapper.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const AfterStep = cucumber.AfterStep
export const Before = cucumber.Before
export const BeforeAll = cucumber.BeforeAll
export const BeforeStep = cucumber.BeforeStep
export const defineStep = cucumber.defineStep
export const defineParameterType = cucumber.defineParameterType
export const Given = cucumber.Given
export const setDefaultTimeout = cucumber.setDefaultTimeout
Expand All @@ -37,7 +38,6 @@ export const wrapPromiseWithTimeout = cucumber.wrapPromiseWithTimeout

// Deprecated
export const Cli = cucumber.Cli
export const defineStep = cucumber.defineStep
export const parseGherkinMessageStream = cucumber.parseGherkinMessageStream
export const PickleFilter = cucumber.PickleFilter
export const Runtime = cucumber.Runtime

0 comments on commit 9fbdd82

Please sign in to comment.