Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use import by default for support code #2337

Merged
merged 4 commits into from Oct 9, 2023
Merged

Conversation

davidjgoss
Copy link
Contributor

@davidjgoss davidjgoss commented Oct 8, 2023

πŸ€” What's changed?

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 your motivation?

From #2059:

The default behaviour (if neither of [require or import options] specified) uses await import()

🏷️ What kind of change is this?

  • πŸ’₯ Breaking change (incompatible changes to the API)

πŸ“‹ Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@davidjgoss davidjgoss added this to the 10.0.0 milestone Oct 8, 2023
@davidjgoss davidjgoss added the πŸ’” breaking change This will require a major release label Oct 8, 2023
@davidjgoss davidjgoss marked this pull request as ready for review October 9, 2023 06:49
@davidjgoss davidjgoss merged commit 5224de2 into main Oct 9, 2023
6 checks passed
@davidjgoss davidjgoss deleted the feat/import-by-default branch October 9, 2023 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸ’” breaking change This will require a major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant