Skip to content

Commit 865894f

Browse files
committed
Merge branch 'cucumber-main'
2 parents 5634903 + 40290f3 commit 865894f

37 files changed

+398
-526
lines changed

CHANGELOG.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,32 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
1111

1212
### Added
1313

14-
* Experimental support for native ES modules via the [`--esm` flag](./docs/cli.md#es-modules-experimental-nodejs-12) ([#1589](https://github.com/cucumber/cucumber-js/pull/1589))
15-
1614
### Changed
1715

16+
* Clarify that the JSON formatter will not be removed any time soon
17+
1818
### Deprecated
1919

2020
### Removed
2121

2222
### Fixed
2323

24+
* Json formatter now works with tagged examples
25+
([#1621](https://github.com/cucumber/cucumber-js/issues/1621)
26+
[#1651](https://github.com/cucumber/cucumber-js/pull/1651))
27+
28+
## [7.2.1] (2021-04-21)
29+
30+
### Fixed
31+
32+
* Temporarily remove ESM changes due to impact on formatters
33+
34+
## [7.2.0] (2021-04-20)
35+
36+
### Added
37+
38+
* Experimental support for native ES modules via the [`--esm` flag](./docs/cli.md#es-modules-experimental-nodejs-12) ([#1589](https://github.com/cucumber/cucumber-js/pull/1589))
39+
2440
## [7.1.0] (2021-04-06)
2541

2642
### Added
@@ -1815,7 +1831,9 @@ be used to get the name / tags of the running scenario. ([#947](https://github.c
18151831
18161832
18171833
<!-- Releases -->
1818-
[Unreleased]: https://github.com/cucumber/cucumber-js/compare/v7.1.0...master
1834+
[Unreleased]: https://github.com/cucumber/cucumber-js/compare/v7.2.1...master
1835+
[7.2.1]: https://github.com/cucumber/cucumber-js/compare/7.2.1-rc.0...7.0.0
1836+
[7.2.0]: https://github.com/cucumber/cucumber-js/compare/7.2.0-rc.0...7.0.0
18191837
[7.1.0]: https://github.com/cucumber/cucumber-js/compare/7.1.0-rc.0...7.0.0
18201838
[7.0.0]: https://github.com/cucumber/cucumber-js/compare/7.0.0-rc.0...v7.0.0
18211839
[7.0.0-rc.0]: https://github.com/cucumber/cucumber-js/compare/v6.0.5...v7.0.0-rc.0

CONTRIBUTING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ Start the container:
7777

7878
make docker-run
7979

80-
Inside the container, update dependencies:
80+
Inside the container, install the correct versions of Node and Yarn:
8181

82+
nvm install --lts
8283
npm install -g yarn
84+
85+
Then update the dependencies and test:
86+
8387
yarn update-dependencies
8488
yarn
8589
yarn test

dependency-lint.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ requiredModules:
4343
- 'dist/**/*'
4444
- 'lib/**/*'
4545
- 'node_modules/**/*'
46-
- 'src/importers.js'
4746
- 'tmp/**/*'
4847
root: '**/*.{js,ts}'
4948
stripLoaders: false

docs/cli.md

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ If multiple formats are specified with the same output, only the last is used.
5959

6060
* **message** - prints each [message](https://github.com/cucumber/cucumber/tree/master/cucumber-messages) in NDJSON form, which can then be consumed by other tools.
6161
* **html** - prints a rich HTML report to a standalone page
62-
* **json** - prints the feature as JSON. *Note: this formatter is deprecated and will be removed in the next major release. Where you need a structured data representation of your test run, it's best to use the `message` formatter. For legacy tools that depend on the deprecated JSON format, a standalone formatter is available (see https://github.com/cucumber/cucumber/tree/master/json-formatter).
62+
* **json** - prints the feature as JSON. *Note: this formatter is in maintenance mode and won't have new features added to it. Where you need a structured data representation of your test run, it's best to use the `message` formatter. Tools that rely on this formatter will continue to work, but are encouraged to migrate to consume the `message` output instead.*
6363
* **progress** - prints one character per scenario (default).
6464
* **progress-bar** - prints a progress bar and outputs errors/warnings along the way.
6565
* **rerun** - prints the paths of any non-passing scenarios ([example](/features/rerun_formatter.feature))
@@ -81,22 +81,6 @@ You can pass in format options with `--format-options <JSON>`. The JSON string m
8181

8282
* Suggested use: add with profiles so you can define an object and use `JSON.stringify` instead of writing `JSON` manually.
8383

84-
## ES Modules (experimental) (Node.js 12+)
85-
86-
You can optionally write your support code (steps, hooks, etc) with native ES modules syntax - i.e. using `import` and `export` statements without transpiling.
87-
88-
To enable this, run with the `--esm` flag.
89-
90-
This will also expand the default glob for support files to include the `.mjs` file extension.
91-
92-
As well as support code, these things can also be in ES modules syntax:
93-
94-
- Custom formatters
95-
- Custom snippets
96-
- Your `cucumber.js` config file
97-
98-
You can use ES modules selectively/incrementally - the module loading strategy that the `--esm` flag activates supports both ES modules and CommonJS.
99-
10084
## Colors
10185

10286
Colors can be disabled with `--format-options '{"colorsEnabled": false}'`
@@ -109,16 +93,16 @@ By default, cucumber exits when the event loop drains. Use the `--exit` flag in
10993
* [Node.js Async Hooks](https://nodejs.org/dist/latest-v8.x/docs/api/async_hooks.html)
11094
* Isolating what scenario or scenarios causes the hang
11195

112-
## Undefined Step Snippets
113-
114-
Undefined steps snippets are printed in JavaScript using the callback interface by default.
115-
11696
## --no-strict
11797

11898
disable _strict_ mode.
11999

120100
By default, cucumber works in _strict_ mode, meaning it will fail if there are pending steps.
121101

102+
## Undefined Step Snippets
103+
104+
Undefined steps snippets are printed in JavaScript using the callback interface by default.
105+
122106
### Interface
123107

124108
Override the snippet interface with `--format-options '{"snippetInterface": "<interface>"}'`.
@@ -196,7 +180,9 @@ If your files end with an extension other than `js`, make sure to also include t
196180
--require-module coffeescript/register --require 'features/**/*.coffee'
197181
```
198182

199-
### Typescript
183+
### TypeScript
184+
185+
Your `tsconfig.json` should have the `resolveJsonModule` compiler option switched on. Other than that, a pretty standard TypeScript setup should work as expected.
200186

201187
#### With ts-node
202188

@@ -227,6 +213,7 @@ require('ts-node').register({
227213
transpileOnly: true,
228214
compilerOptions: {
229215
"module": "commonjs",
216+
"resolveJsonModule": true,
230217
},
231218
});
232219
```

docs/migration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ There are a few minor differences to be aware of:
4848

4949
- The type for data tables was named `TableDefinition` - it's now named `DataTable`
5050
- `World` was typed as an interface, but it's actually a class - you should `extend` it when [building a custom formatter](./custom_formatters.md)
51+
52+
Also, your `tsconfig.json` should have the `resolveJsonModule` compiler option switched on. Other than that, a pretty standard TypeScript setup should work as expected.

features/esm.feature

Lines changed: 0 additions & 80 deletions
This file was deleted.

features/scenario_outlines.feature

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,55 @@ Feature: Scenario Outlines and Examples
9393
When I run cucumber-js
9494
Then it fails
9595
And it runs 4 scenarios
96+
97+
Scenario: scenario outlines with tagged examples
98+
Given a file named "features/scenario_outline.feature" with:
99+
"""
100+
Feature: a feature
101+
Scenario Outline: a scenario
102+
Given a step <id>
103+
104+
@examples @tag
105+
Examples:
106+
| id |
107+
| 1 |
108+
| 2 |
109+
"""
110+
And a file named "features/step_definitions/cucumber_steps.js" with:
111+
"""
112+
const {Given} = require('@cucumber/cucumber')
113+
114+
Given('a step {int}', function(int) {})
115+
"""
116+
When I run cucumber-js with `-f json`
117+
Then it passes
118+
And it runs 2 scenarios
119+
120+
Scenario: scenario outlines with multiple example tables
121+
Given a file named "features/scenario_outline.feature" with:
122+
"""
123+
Feature: a feature
124+
Scenario Outline: a scenario
125+
Given a step <id>
126+
127+
@example @id-1-2
128+
Examples:
129+
| id |
130+
| 1 |
131+
| 2 |
132+
133+
@example @id-3-4
134+
Examples:
135+
| id |
136+
| 3 |
137+
| 4 |
138+
"""
139+
And a file named "features/step_definitions/cucumber_steps.js" with:
140+
"""
141+
const {Given} = require('@cucumber/cucumber')
142+
143+
Given('a step {int}', function(int) {})
144+
"""
145+
When I run cucumber-js with `-f json`
146+
Then it passes
147+
And it runs 4 scenarios

features/support/hooks.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Before('@debug', function (this: World) {
1313
this.debug = true
1414
})
1515

16-
Before('@spawn or @esm', function (this: World) {
16+
Before('@spawn', function (this: World) {
1717
this.spawn = true
1818
})
1919

@@ -43,18 +43,6 @@ Before(function (
4343
this.localExecutablePath = path.join(projectPath, 'bin', 'cucumber-js')
4444
})
4545

46-
Before('@esm', function (this: World) {
47-
const [majorVersion] = process.versions.node.split('.')
48-
if (Number(majorVersion) < 12) {
49-
return 'skipped'
50-
}
51-
fsExtra.writeJSONSync(path.join(this.tmpDir, 'package.json'), {
52-
name: 'feature-test-pickle',
53-
type: 'module',
54-
})
55-
return undefined
56-
})
57-
5846
Before('@global-install', function (this: World) {
5947
const tmpObject = tmp.dirSync({ unsafeCleanup: true })
6048

0 commit comments

Comments
 (0)