Cucumber-js: [Documentation] Provide clearer instructions on how to use transpilers

Created on 28 May 2018  ·  4Comments  ·  Source: cucumber/cucumber-js


After a good amount of reading / searching, I still can't wrap my head around how exactly I can run cucumber-js with Typescript. I understand --compiler was removed in favor of --require-module but I fail to find concrete examples that use simply cucumber-js + typescript (not with Protractor, not with Nightwatch or any other test framework) to illustrate the process.

  • How would one run the cucumber-js app with ts-node ?

Right now, I'm using cucumber-js --require-module ts-node/register in my package.json (cucumber-js is installed locally, not globally), is this correct ?

  • How exactly am I supposed to load support files ? Do I have to explicitely --require stuff inside support and step_definitions with the use of CLI flags or having the proper folder structure takes care of this ?

Right now, my folder structure looks like this :

- [root app folder]
-- package.json
-- features/
---- myExample.feature
---- step_definitions/
------ myExample.ts
---- support/
------ customWorld.ts

When I run the tests, I get an output specifying that all steps in my feature file are undefined, I think this might be a transpiling issue but I'm not sure.

Most helpful comment

Hi @Niceplace, this repo may help you: cucumber-ts-starter

All 4 comments

Hi @Niceplace, this repo may help you: cucumber-ts-starter

Closing for now. Please reopen if you think we can structure our documentation better. Maybe we should add a top level link to transpilers?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings