Skip to content

Cucumber does not support Error cause. #2515

@HermansJarno

Description

@HermansJarno

👓 What did you see?

Error cause is lost in format_error and cucumber/pretty-formatter does not print causes.

At our project we log errors with causes, but the cause is filtered out by cucumber.
I noticed this happens in format_error where a new error is built in the exception property.

I manually added in my node_modules for cucumber in format_error.js (just to test) the cause. Next, I still saw that the cause was ignored, hence it being emitted on the envelope.

The reason we log causes is because we wrapped cucumber to work with our own testing framework. We work with the cucumber/api

✅ What did you expect to see?

We expect the cause to be emitted by cucumber, and if possible, also be formatted by the pretty-formatter.

📦 Which tool/library version are you using?

node v18.20.2
cucumber ^v11.1

🔬 How could we reproduce it?

try {
throw new Error('Original cause error')
}
catch(e) {
throw new Error('message', { cause: e })
}

📚 Any additional context?

No response

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