Not possible to use --require-module ts-node/register along with cucumber.js

See original GitHub issue

Hi,

I have a cucumber-js project written in Typescript and I’m calling an npm script for transpiling Typescript files with tsc before executing the project:

node ./node_modules/cucumber/bin/cucumber-js

js files are generated in a separate folder called transpiled. I also have a cucumber.js for loading a profile which looks like this:

const { DefaultCucumberProfileBuilder } = require('./transpiled/acceptance/config/DefaultCucumberProfileBuilder');

module.exports = DefaultCucumberProfileBuilder.build();

This is working fine, but If I try to require ts-node module in order to avoid calling tsc: node ./node_modules/cucumber/bin/cucumber-js --require-module ts-node/register

I’m getting the following error: Error: Cannot find module 'acceptance/config/DefaultCucumberProfileBuilder'

DefaultCucumberProfileBuilder is a Typscript class.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Izhakicommented, Jan 18, 2019

try:

const { DefaultCucumberProfileBuilder } = 
 require('./acceptance/config/DefaultCucumberProfileBuilder');
0reactions
lock[bot]commented, Jan 18, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cucumber/cucumber-js - Gitter
Hi everyone, I've got edge node & npm versions, but struggle with using import statements with cucumber-js. Research so far says I should...
Read more >
Proper usage of cucumber with typescript? - Stack Overflow
You can just run cucumber with the typescript transpiler using --require-module ts-node/register . Full example courtesy of hdorgeval at ...
Read more >
Playwright and Cucumber.js BDD tutorial | Blog | ediblecode
A tutorial for setting up automated BDD cross-browser functional tests using Cucumber.js, Playwright and TypeScript.
Read more >
Reviews: Cucumber.js - IntelliJ IDEs Plugin | Marketplace
At /CucumberJavaScript/lib/cucumberjs_formatter_v7.js:191:25 186 function ... Does not work with cucumber since version 6. ... Not working.
Read more >
Frameworks - WebdriverIO
Please note that this is a @wdio/cucumber-framework specific option and not recognized by cucumber-js itself. Type: boolean. Default: false. names​. Only ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found