cucumber / cucumber-js

Cucumber for JavaScript
https://cucumber.io
MIT License
5.07k stars 1.09k forks source link

ESM with TS not working #2401

Closed jakub-zebrowski closed 6 months ago

jakub-zebrowski commented 6 months ago

👓 What did you see?

TypeError: (0 , node_module_1.register) is not a function

Screenshot 2024-05-02 at 11 41 07

✅ What did you expect to see?

Working tests

📦 Which tool/library version are you using?

Cucumberjs 10.6.0 Node 18.12 Vite 5.2.10 ts 5.2.2 ts-node 10.9.2 tsconfig paths 4.2.0 pnpm 9.0.1

🔬 How could we reproduce it?

Did everything regarding the setup of ESM https://github.com/cucumber/cucumber-js/blob/main/docs/transpiling.md#esm Screenshot 2024-05-02 at 11 45 25

Screenshot 2024-05-02 at 11 44 31 Tired with ts-node setup within the tsconfig and without I'm not sure if I need to set something else, but the error is not really meaningful. If I fallback to the commonsjs setup, everything works

📚 Any additional context?

No response

davidjgoss commented 6 months ago

Hi @jakub-zebrowski, with Node.js 18 you will need at least version 18.19.0 for the loader config to work. If you're not able to upgrade then the environment variable option should still work for you.

This is missing from the docs so I will get that addressed now.