Running our scenarios

Before we implement the logic behind each step definition, let's make sure our setup is working. By default, Cucumber will look for step definitions inside a root-level features/ directory; since we placed our definitions in a different directory, we must use the --require flag to tell Cucumber where to find them.

Run npx cucumber-js spec/cucumber/features --require spec/cucumber/steps to trigger the tests:

$ npx cucumber-js spec/cucumber/features --require spec/cucumber/stepsspec/cucumber/steps/index.js:1(function (exports, require, module, __filename, __dirname) { import { Given, When, Then } from 'cucumber';                                                              ^^^^^^SyntaxError: Unexpected token import

It returns with a SyntaxError: Unexpected token import error. This ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.