Skip to content
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

Open up const { Cli } = require('@cucumber/cucumber') for programmatic usage #1710

Closed
nicojs opened this issue Jun 28, 2021 · 4 comments
Closed
Labels
📖 documentation Improvements or additions to documentation

Comments

@nicojs
Copy link
Contributor

nicojs commented Jun 28, 2021

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 stryker-mutator/stryker-js#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.

@aurelien-reeves aurelien-reeves added 🏦 debt Tech debt 📖 documentation Improvements or additions to documentation ✅ accepted The core team has agreed that it is a good idea to fix this and removed ✅ accepted The core team has agreed that it is a good idea to fix this labels Jun 28, 2021
@aurelien-reeves
Copy link
Contributor

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?

@aurelien-reeves aurelien-reeves removed the 🏦 debt Tech debt label Jun 28, 2021
@davidjgoss
Copy link
Contributor

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.

@davidjgoss
Copy link
Contributor

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.

@OhadR
Copy link

OhadR commented Jan 31, 2022

another use case:

we have AWS env on VPC with very limited access from outside. I would like to have a cucumber on this env for tests. So i wrapped my cucumber project in a docker and deployed it on that VPC. it works like a charm but it is very cumbersome to invoke the tests - you have to enter the docker and run the test by npm test. It could be great to expose a port to that docker, and be able to invoke the tests calling that API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants