Previously if you specified neither require nor import options, Cucumber would look under your feature directories for .js files and load them using require(). As part of our gradual move to the newer JavaScript modules system, we want to have that default behaviour use await import() instead.
This should be backwards-compatible for at least 99% of cases, since CommonJS code can still be loaded with await import(). The require option should only be needed when transpiling with require-module - although in those cases users are almost certainly specifying the require option already due the different file extensions like .ts. There's now a warning emitted if require-module values are provided but no require which should help guide users. Nevertheless we'll release this under a major.
Also, update documentation to emphasise import over require, and JSON over other configuration file formats.
🤔 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 https://github.com/cucumber/cucumber-js/discussions/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.