Cucumber-js: Open up `const { Cli } = require('@cucumber/cucumber')` for programmatic usage

Created on 28 Jun 2021  路  3Comments  路  Source: cucumber/cucumber-js

Is your feature request related to a problem? Please describe.
I'm in the process of adding support for cucumber-js in StrykerJS, the mutation testing framework for JavaScript and friends. See https://github.com/stryker-mutator/stryker-js/pull/2970

I would like to use cucumber programmatically. In fact, I'm already doing that in the MR. However, I realize that I'm using an undocumented API, which I don't like doing, since the implementation could break in a patch release version. I strive to use public APIs only.

Describe the solution you'd like

Would you accept a PR that documents the use of the Cli class for public usage?

const { Cli } = require('@cucumber/cucumber')

I would add it to your docs directory. Either in a new file (programmatic-usage.md) or add it to the cli.md file.

Describe alternatives you've considered
-

Additional context
In order to make mutation testing feasible, we need a programmatic API. Simply calling childProcess.exec to execute cucumber-js would work, but is terrible for performance since Stryker will run cucumber-js many times during a mutation testing run.

documentation

Most helpful comment

Hey @nicojs, your timing is impeccable! I'm writing a proposal for a new programmatic API this morning that hopefully will be of benefit to you. I'll tag you there as it would be great to get your initial feedback.

All 3 comments

You are not the only one using the internal APIs for a programmatic usage.

I think it would be a good idea to stabilize such an API and to document it.

@cucumber/cucumber-js what do you think?

Hey @nicojs, your timing is impeccable! I'm writing a proposal for a new programmatic API this morning that hopefully will be of benefit to you. I'll tag you there as it would be great to get your initial feedback.

Going to close this as we're having a good discussion over on #1711 about a new API to solve this need.

I'll just add that the intent is to leave the Cli class working the way it is in 8.0.0, even though it's not on the public API, to give developers time to switch to the new API and iron out any issues there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hdorgeval picture hdorgeval  路  3Comments

kozhevnikov picture kozhevnikov  路  6Comments

dblooman picture dblooman  路  7Comments

travi picture travi  路  5Comments

stefdelec picture stefdelec  路  6Comments