Cucumber-js: Unable to run cucumber with multiple steps files.

Created on 12 Feb 2018  ·  3Comments  ·  Source: cucumber/cucumber-js

I've been trying to use cucumber with multiple steps files to no avail. I'm using typescript steps definitions with the command:

./node_modules/.bin/cucumber-js src --require src/steps/*.steps.ts --require-module ts-node/register

But then an error pops up:

Error: (1:1): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'import { CallbackStepDefinition as CB, Given, When, Then } from 'cucumber';'

I put a console.log in lib/cli/argv_parser.js after program.parse(args), which outputs:

[ 'src', 'src/steps/example2.steps.ts' ]

Apparently the second steps file is mistakenly fed as a feature file.

I have included a minimally reproducible repository here: https://github.com/protoman92/cucumber-lightweight-sample.

Most helpful comment

Can you try

./node_modules/.bin/cucumber-js src --require 'src/steps/*.steps.ts' --require-module ts-node/register

The quotes around the glob prevent it from being expanded by your shell.

All 3 comments

Can you try

./node_modules/.bin/cucumber-js src --require 'src/steps/*.steps.ts' --require-module ts-node/register

The quotes around the glob prevent it from being expanded by your shell.

@charlierudolph That worked wonders :) Thanks a lot.

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