Cucumber for JavaScript 9.0.0
  March 09, 2023

Cucumber 9.0.0 has been released and is available now on npm!

Thanks to semantic versioning, 9.0.0 itself is quite a boring release on the face of it - a couple of very undramatic breaking changes. Still, it’s a good time to lay out what’s happened since 8.0.0, and look ahead to some of the improvements we’re working on for the rest of this year.

Before we get into it, huge thanks to the core team plus these contributors for making this release possible: Ronald Chen, Matt Travi, Douglas Eggleton, Julien Gonzalez, Konstantin Epishev, Jeff Tian, Manny, Ricardo Albuquerque, Jaryk, Oliver Odo, Michael Lloyd Morris and Long Nguyen.

Node.js

As always, a major release means dropping support for Node.js versions that are no longer officially supported, and so we say goodbye to versions 12 and 17.

Named hooks

(Added in v8.1.0)

A small but often-requested enhancement: you can name Before and After hooks and the name will show up in formatter output. You might find it useful if you have several hooks and want a clearer picture of what’s going on and where failures originate.

    
Before({ name: 'Set up some test state' }, function () {
// do stuff here
});
    

Read the documentation on named hooks

YAML configuration files

(Added in v8.10.0)

We already supported configuration files in JavaScript (both CommonJS and ESM flavours) and JSON, so it seemed rude not to support the current de-facto standard for configuration files:

    
# cucumber.yml
default:
parallel: 2
format:
- "html:cucumber-report.html"
    

Read the documentation on configuration files

Debug logging

(Added in v8.6.0)

Speaking of configuration, if something’s not quite working right with your setup it can be useful to see more about which configuration is active and what Cucumber is doing with that. So you can now enable debug logging, and Cucumber will emit lots of useful info to stderr which might help you pin down your problem. You just need to set an environment variable when you run:

DEBUG=cucumber

Read the documentation on debugging

JUnit formatter

(Added in v8.9.0)

Many CI tools use the JUnit XML format as a standard way to consume test results. We now have a built-in formatter for this:

$ cucumber-js --format junit:TEST-cucumber.xml

(Special thanks to Ricardo Albuquerque for contributing this formatter.)

Read the documentation on formatters

Honourable mentions

  • The html formatter's output continues to improve, in particular with better support for drilling down into errors and attachments for each example in a scenario outline
  • We now have smarter default handling of colors for terminal output, including support for FORCE_COLOR pseudo-standard

And, of course, many small bug fixes along the way.

What's next

About a year ago, we added the JavaScript API as a first-class way to invoke Cucumber without the command line interface. This was a big step to better supporting our friends across the community who are integrating Cucumber into a larger framework. The next big step is related, and focuses more on use cases for extending/augmenting the functionality of Cucumber, and for that we need a Plugins concept. It's still early days but we're aspiring to release initial support during 2023. You can follow the related discussion and feel free to weigh in if you're interested.

Meanwhile, the ecosystem continues to move towards ES Modules. Cucumber supports both ESM and CommonJS, and while it's very unlikely the dial will move enough in 2023 to change this, look out for subtler changes to cement ESM as the default approach for loading user code and transpiling.

Finally, we'd love more people to get involved in Cucumber's development. If you'd like to dip your toe in, our "good first issue" label might be a place to start.