Skip to content

Cannot find cli config file if it has extension .cjs #1771

Closed
@JeremiePat

Description

@JeremiePat

Describe the bug
When configuring the CLI parameters with a config file, this file must be called cucumber.js

This is an issue when your Node.js project as the type module because it expect JS file to be ESM module rather than CommonJS modules. In such case, cucumber.js must be an ESM module, but if so it is not understood and ends up with an error or it must be called cucumber.cjs and in such case the cucumber-js cli ignore the file.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a new project
  2. do npm init
  3. add the key type with the value module in the package.json file
  4. set up cucumber-js
  5. Add a cucumber.js file
  6. run npx cucumber-js
  7. See it fail
  8. rename cucumber.js to cucumber.cjs
  9. run npx cucumber-js
  10. See the configuration not being loaded

Expected behavior
cucumber.js could be alternatively named cucumber.cjs or it could be written as a valid ESM module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugDefect / Bug✅ acceptedThe core team has agreed that it is a good idea to fix this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions