use import by default for support code #2337
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤔 What's changed?
Previously if you specified neither
require
norimport
options, Cucumber would look under your feature directories for.js
files and load them usingrequire()
. As part of our gradual move to the newer JavaScript modules system, we want to have that default behaviour useawait import()
instead.This should be backwards-compatible for at least 99% of cases, since CommonJS code can still be loaded with
await import()
. Therequire
option should only be needed when transpiling withrequire-module
- although in those cases users are almost certainly specifying therequire
option already due the different file extensions like.ts
. There's now a warning emitted ifrequire-module
values are provided but norequire
which should help guide users. Nevertheless we'll release this under a major.Also, update documentation to emphasise
import
overrequire
, and JSON over other configuration file formats.⚡️ What's your motivation?
From #2059:
🏷️ What kind of change is this?
📋 Checklist:
This text was originally generated from a template, then edited by hand. You can modify the template here.