Skip to content

Commit

Permalink
chore(cucumber): upgrade to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien Thouraud committed Jul 15, 2021
1 parent 3ebe10a commit d778171
Show file tree
Hide file tree
Showing 25 changed files with 530 additions and 242 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
cucumber-version: [4.x, 5.x, 6.x]
cucumber-version: [7.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn add -P cucumber@${{ matrix.cucumber-version }}
- run: yarn add -P @cucumber/cucumber@${{ matrix.cucumber-version }}
- run: yarn run lint
- run: yarn run check-fmt
- run: yarn run test-cover
Expand Down
77 changes: 77 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions .yarn/releases/yarn-2.4.2.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yarnPath: .yarn/releases/yarn-2.4.0.cjs
yarnPath: .yarn/releases/yarn-2.4.2.cjs
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ It's also the perfect companion for testing CLI applications built with commande
- [File System testing](#file-system-testing)
- [Testing file content](#testing-file-content)
- [Snapshot testing](#snapshot-testing)
- [API Snapshot testing](api-snapshot-testing)
- [CLI Snapshot testing](cli-snapshot-testing)
- [File Snapshot testing](file-snapshot-testing)
- [API Snapshot testing](#api-snapshot-testing)
- [CLI Snapshot testing](#cli-snapshot-testing)
- [File Snapshot testing](#file-snapshot-testing)
- [Extensions](#extensions)
- [**state**](#state-extension) [install](#state-installation) | [gherkin expressions](#state-gherkin-expressions) | [low level API](#state-low-level-api)
- [**fixtures**](#fixtures-extension) [install](#fixtures-installation) | [low level API](#fixtures-low-level-api)
Expand All @@ -49,7 +49,7 @@ It's also the perfect companion for testing CLI applications built with commande
## Requirements

- Node.js `>=8.12.0`
- cucumber `>=4.0.0`
- cucumber `>=7.0.0`

## Installation

Expand All @@ -70,7 +70,7 @@ Then all you have to do is installing the provided extensions:
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state, fixtures, httpApi, cli } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand Down Expand Up @@ -598,7 +598,7 @@ To install the extension, you should add the following snippet to your `world` f
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand Down Expand Up @@ -629,7 +629,7 @@ For available methods on the state, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_state_State.html).

```javascript
const { When } = require('cucumber')
const { When } = require('@cucumber/cucumber')

When(/^I do something useful$/, function() {
const stateValue = this.state.get('whatever')
Expand All @@ -656,7 +656,7 @@ To install the extension, you should add the following snippet to your `world` f
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { fixtures } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand All @@ -673,14 +673,14 @@ For available methods on the fixtures loader, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_fixtures_FixturesLoader.html).

```javascript
const { When } = require('cucumber')
const { When } = require('@cucumber/cucumber')

When(/^I do something useful with fixtures$/, function() {
return this.fixtures.load('whatever')
.then(fixture => {
//
})

})
```

### http API extension
Expand All @@ -697,7 +697,7 @@ to your `world` file:
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state, fixtures, httpApi } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand Down Expand Up @@ -762,7 +762,7 @@ For available methods on the client, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_httpApi_client.html).
```javascript
const { When } = require('cucumber')
const { When } = require('@cucumber/cucumber')

When(/^I do something useful$/, function() {
return this.httpApiClient.makeRequest(/* … */)
Expand All @@ -783,7 +783,7 @@ to your `world` file:
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state, fixtures, cli } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand Down Expand Up @@ -826,7 +826,7 @@ For available methods on the client, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_Cli_Cli.html).
```javascript
const { When } = require('cucumber')
const { When } = require('@cucumber/cucumber')

Then(/^I check something from the CLI output$/, function() {
const out = this.cli.getOutput()
Expand All @@ -847,7 +847,7 @@ to your `world` file:
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state, fixtures, cli, fileSystem } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand Down Expand Up @@ -885,7 +885,7 @@ For available methods on the fileSystem, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_FileSystem_FileSystem.html).
```javascript
const { Then } = require('cucumber')
const { Then } = require('@cucumber/cucumber')

Then(/^I check something using file system$/, function() {
return this.fileSystem.getFileContent('whatever')
Expand All @@ -908,7 +908,7 @@ to your `world` file:
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state, fixtures, cli, fileSystem, snapshot } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand All @@ -933,12 +933,12 @@ For available methods on the snapshot, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_snapshot_Snapshot.html).

```javascript
const { Then } = require('cucumber')
const { Then } = require('@cucumber/cucumber')

Then(/^Some content should match snapshot$/, function() {
this.snapshot.expectToMatch('whatever')

``
})
```

## Helpers

Expand All @@ -959,7 +959,7 @@ For example:

```javascript
const { cast } = require('@ekino/veggies')
const { Given, When, Then } = require('cucumber')
const { Given, When, Then } = require('@cucumber/cucumber')

Then(/^User data should be$/, (step) => {
const userData = this.userData
Expand Down
42 changes: 21 additions & 21 deletions doc/README.tpl.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ It's also the perfect companion for testing CLI applications built with commande
- [File System testing](#file-system-testing)
- [Testing file content](#testing-file-content)
- [Snapshot testing](#snapshot-testing)
- [API Snapshot testing](api-snapshot-testing)
- [CLI Snapshot testing](cli-snapshot-testing)
- [File Snapshot testing](file-snapshot-testing)
- [API Snapshot testing](#api-snapshot-testing)
- [CLI Snapshot testing](#cli-snapshot-testing)
- [File Snapshot testing](#file-snapshot-testing)
- [Extensions](#extensions)
- [**state**](#state-extension) [install](#state-installation) | [gherkin expressions](#state-gherkin-expressions) | [low level API](#state-low-level-api)
- [**fixtures**](#fixtures-extension) [install](#fixtures-installation) | [low level API](#fixtures-low-level-api)
Expand All @@ -49,7 +49,7 @@ It's also the perfect companion for testing CLI applications built with commande
## Requirements

- Node.js `>=8.12.0`
- cucumber `>=4.0.0`
- cucumber `>=7.0.0`

## Installation

Expand All @@ -70,7 +70,7 @@ Then all you have to do is installing the provided extensions:
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state, fixtures, httpApi, cli } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand Down Expand Up @@ -602,7 +602,7 @@ To install the extension, you should add the following snippet to your `world` f
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand All @@ -626,7 +626,7 @@ For available methods on the state, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_state_State.html).

```javascript
const { When } = require('cucumber')
const { When } = require('@cucumber/cucumber')

When(/^I do something useful$/, function() {
const stateValue = this.state.get('whatever')
Expand All @@ -653,7 +653,7 @@ To install the extension, you should add the following snippet to your `world` f
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { fixtures } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand All @@ -670,14 +670,14 @@ For available methods on the fixtures loader, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_fixtures_FixturesLoader.html).

```javascript
const { When } = require('cucumber')
const { When } = require('@cucumber/cucumber')

When(/^I do something useful with fixtures$/, function() {
return this.fixtures.load('whatever')
.then(fixture => {
//
})

})
```

### http API extension
Expand All @@ -694,7 +694,7 @@ to your `world` file:
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state, fixtures, httpApi } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand Down Expand Up @@ -723,7 +723,7 @@ For available methods on the client, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_httpApi_client.html).

```javascript
const { When } = require('cucumber')
const { When } = require('@cucumber/cucumber')

When(/^I do something useful$/, function() {
return this.httpApiClient.makeRequest(/**/)
Expand All @@ -744,7 +744,7 @@ to your `world` file:
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state, fixtures, cli } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand Down Expand Up @@ -772,7 +772,7 @@ For available methods on the client, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_Cli_Cli.html).

```javascript
const { When } = require('cucumber')
const { When } = require('@cucumber/cucumber')

Then(/^I check something from the CLI output$/, function() {
const out = this.cli.getOutput()
Expand All @@ -793,7 +793,7 @@ to your `world` file:
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state, fixtures, cli, fileSystem } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand Down Expand Up @@ -823,7 +823,7 @@ For available methods on the fileSystem, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_FileSystem_FileSystem.html).

```javascript
const { Then } = require('cucumber')
const { Then } = require('@cucumber/cucumber')

Then(/^I check something using file system$/, function() {
return this.fileSystem.getFileContent('whatever')
Expand All @@ -846,7 +846,7 @@ to your `world` file:
```javascript
// /support/world.js

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state, fixtures, cli, fileSystem, snapshot } = require('@ekino/veggies')

setWorldConstructor(function() {
Expand All @@ -871,12 +871,12 @@ For available methods on the snapshot, please refer to its own
[documentation](https://ekino.github.io/veggies/module-extensions_snapshot_Snapshot.html).

```javascript
const { Then } = require('cucumber')
const { Then } = require('@cucumber/cucumber')

Then(/^Some content should match snapshot$/, function() {
this.snapshot.expectToMatch('whatever')

``
})
```

## Helpers

Expand All @@ -897,7 +897,7 @@ For example:

```javascript
const { cast } = require('@ekino/veggies')
const { Given, When, Then } = require('cucumber')
const { Given, When, Then } = require('@cucumber/cucumber')

Then(/^User data should be$/, (step) => {
const userData = this.userData
Expand Down
4 changes: 2 additions & 2 deletions examples/support/definitions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'

const { Given } = require('cucumber')
const { Given } = require('@cucumber/cucumber')

Given(/^(?:I )?define http mock from (.+)$/, function(fixture) {})
Given(/^(?:I )?define http mock from (.+)$/, function (fixture) {})
8 changes: 4 additions & 4 deletions examples/support/http_api/fixtures.steps.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
'use strict'

const querystring = require('querystring')
const { Given, Then } = require('cucumber')
const { Given, Then } = require('@cucumber/cucumber')
const nock = require('nock')
const { expect } = require('chai')

Given(/^I mock http call to forward request body for path (.+)$/, function(path) {
Given(/^I mock http call to forward request body for path (.+)$/, function (path) {
nock('http://fake.io')
.post(path)
.reply(200, (uri, requestBody) => requestBody)
})

Then(/^response should match url encoded snapshot (.+)$/, function(snapshotId) {
Then(/^response should match url encoded snapshot (.+)$/, function (snapshotId) {
const httpResponse = this.httpApiClient.getResponse()
expect(httpResponse).to.not.be.empty
return this.fixtures.load(snapshotId).then(snapshot => {
return this.fixtures.load(snapshotId).then((snapshot) => {
expect(httpResponse.body).to.equal(querystring.stringify(snapshot))
})
})
4 changes: 2 additions & 2 deletions examples/support/world.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict'

const { setWorldConstructor } = require('cucumber')
const { setWorldConstructor } = require('@cucumber/cucumber')
const { state, fixtures, httpApi, cli, fileSystem, snapshot } = require('../../src')

setWorldConstructor(function() {
setWorldConstructor(function () {
state.extendWorld(this)
fixtures.extendWorld(this)
httpApi.extendWorld(this)
Expand Down
Loading

0 comments on commit d778171

Please sign in to comment.