-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Documentation improvement request #2339
Comments
Also, FYI this was on node 18.14.2 |
This is not something we'll have documentation for in cucumber-js - event just the React ecosystem has virtually infinite different combinations of structure and dependencies, all of which is a moving target, even before we get to any other ecosystems. Happy to look at adding a basic example to https://github.com/cucumber/cucumber-js-examples though. |
Sure. I get where you are coming from. I think it's probably a simpler set of combinations though. (happy to be wrong) For example cucumber can be used client or server side. Assuming the project under development is either commonjs or esm, it could have commonjs and/or esm dependencies. I just don't think (and I'd be very happy to be wrong here) that babel and ts-node for example can work in all those scenarios. Having some guidance to say, in the scenario of client side Esm project using both commonjs and esm dependencies, to say use TSX and here's a config we know works would be super useful. |
The cucumber typescript example you linked to is a perfect example of something that works some of the time, but not all of the time for different dependencies. Finding that out leaves you a bit blind sided, and then you have to embark on a nightmare of, in our case, about 10 days dev time to sort out. We came close to giving up on cucumber as a result. |
We just removed cucumber from one of our projects because of this bottomless pit of issues. I might have done something wrong (which isn't surprising considering the vague docs on how to get ESM with typescript support). This example does not help at all since it doesn't even have a tsconfig 🤷: https://github.com/cucumber/cucumber-js-examples/tree/main/examples/typescript-node
|
Not sure if this will resolve any of the issues here but thought I'd share a recent comment I made in this closed issue where I got |
🤔 What's the problem you've observed?
Setting up cucumberjs with a react application is a nightmare.
Should we use --require or --import?
Should we use ts-node? ts-node/esm? babel? tsc? tsx?
What are the magic combination of tsconfig, package.json and NODE_OPTIONS that are needed to get it working?
✨ Do you have a proposal for making it better?
Give at least one example of the above that you know works. Otherwise it's just going to invite developers to duplicate a lot of effort to find out the above
📚 Any additional context?
From my experience, the only one I got working was tsx. The 'test' scenario was a react application created using CreateReactApp, which imports the following troublesome libraries:
[email protected] - A pure ESM module
[email protected] - A cjs only library
I also needed to use the following:
tsx
esm-loader-css
With the following config:
package.json
"type": "module"
tsconfig.json (key parts - some may not be needed)
"target": "ES2017",
"module": "esnext",
"moduleResolution": "node",
"allowJs": true,
"allowSyntheticDefaultImports": true,
"allowArbitrartExtensions": true",
"isolatedModules": true
"include": [
"src/**/*"
]
cucumber.mjs (key parts) - NOTE: use REQUIRE NOT IMPORT
require: ["src/test/setup.ts", "src//*.steps.ts", "src//*.steps.tsx"]
requireModule: ["global-jsdom/register", "tsconfig-paths/register"]
NODE_OPTIONS="--loader tsx --loader esm-loader-css"
Issues:
ts-node - didn't work with rgb-hex as doesn't seem to be able to convert node_module packages
babel - close but again couldn't get it to work with rgb-hex as doesn't seem to be able to convert node_module packages (Note that JEST gets around this with this)
This text was originally generated from a template, then edited by hand. You can modify the template here.
The text was updated successfully, but these errors were encountered: