0

I need to use Cucumber in a project that uses path aliasing. As soon as I would import one of the path aliased modules, I get an error

I have tried solution in this answer, but I am running into another problem: Whenever I use the

   --require-module tsconfig-paths/register \

part, I suddenly get

    TypeError: cucumber_1.Given is not a function

error whenever I try to run the features.

(The error changes to TypeError: Given is not a function when I use the const { Given } = require('cucumber') syntax)

Is there any other solution for path aliasing in Cucumber, or is there a fix to the is not a function problem?

Milan Smolík
  • 149
  • 1
  • 2
  • 8

1 Answers1

0

Turns out I was using cucumber.js file at root as config, which was interfering with tsconfig-paths/register: tsconfig then picked up the cucumber.js file for from 'cucumber', instead of the cucumber module.

So the fix is to write all the --require-module options to the command line instead

Milan Smolík
  • 149
  • 1
  • 2
  • 8