You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add mjs wrapper
* use import instead of require for support code
* support es2018 compile target
* separate cli for esm, override importer fn
* include mjs wrapper in package
* add feature for testing with esm
* for now, bail if on windows
* all same exports as cjs entry point
* pivot to single binary with flag and hack to import import
* fix feature file wording
* fix lint and test
* skip esm scenario if not node 12 or higher
* make it fail with imports in cucumber.js file
* make it work for cucumber.js file
* make it fail for a custom formatter
* avoid collision
* make importing formatters work
* make custom snippets work
* Include .mjs files by default if using ESM
* test with and without parallel
* unignore windows in esm tests
* add cli doc
* add changelog entry
* rename this
* sometimes use `pathToFileURL` as appropriate
* readd semi
* rework config builder tests
* further resimplify test
* improve doco
* include importer.js in src, copy at build time
* link to docs from changelog entry
* put wrapper.mjs in src as well
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
11
11
12
12
### Added
13
13
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))
Copy file name to clipboardExpand all lines: docs/cli.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,22 @@ You can pass in format options with `--format-options <JSON>`. The JSON string m
81
81
82
82
* Suggested use: add with profiles so you can define an object and use `JSON.stringify` instead of writing `JSON` manually.
83
83
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
+
84
100
## Colors
85
101
86
102
Colors can be disabled with `--format-options '{"colorsEnabled": false}'`
0 commit comments