-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I'm excited to start migrating projects of mine that are tested with cucumber over to native ESM. However, as mentioned in #1304 (comment), loaders do not appear to work with the recent release candidate. I'm unsure if this is intended to work at this point, but I wasnt able to figure it out on my own.
instead, i meet the following error:
(node:62231) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /path/to/project/node_modules/@cucumber/cucumber/bin/cucumber-js
at defaultGetFormat (internal/modules/esm/get_format.js:71:15)
at getFormat (file:///path/to/project/node_modules/quibble/lib/quibble.mjs:65:12)
at Loader.getFormat (internal/modules/esm/loader.js:104:42)
at Loader.getModuleJob (internal/modules/esm/loader.js:242:31)
at async Loader.import (internal/modules/esm/loader.js:176:17)
at async Object.loadESM (internal/process/esm_loader.js:68:5) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
Describe the solution you'd like
A clear and concise description of what you want to happen.
ideally, the cucumber-js
binary would accept --loader=<loader-name>
directly
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
an alternative that should work is providing the loader through NODE_OPTIONS
, like NODE_OPTIONS="--loader=testdouble" cucumber-js ...
Additional context
Add any other context or screenshots about the feature request here.
As requested in #1304 (comment), I've created a fairly minimal reproducible example at https://github.com/travi-test/cucumber-esm/.
The error can be demonstrated by running npm run test:integration
(after npm install
, of course). If the --loader=testdouble
is removed from the test:integration:base
script, the error goes away. In this minimal example that results in the tests passing because I'm not actually using the loader.
In a more realistic project, this obviously results in the loader not working, resulting in failures. An example of a more real project can be found in the cucumber-esm
branch of https://github.com/pragmatic-divops/cli where I'm attempting to begin the process of converting the project to ESM.