Skip to content

Documentation improvement request #2339

Open
@jfstephe

Description

@jfstephe

🤔 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions