Open
Description
👓 What did you see?
After a fresh installation of Cucumber with @cucumber/cucumber@10.3.1 over an Angular@17.2.0 project the cucumber steps start to fail with error
import { Given } from "@cucumber/cucumber";
^^^^^^
SyntaxError: Cannot use import statement outside a module
This exception starts to fail not at the first coding iteration but when the steps start to have dependencies to use dependency injections.
✅ What did you expect to see?
The complete runs of the defined cucumber steps
📦 Which tool/library version are you using?
Angular 17.2.0
Cucumber 10.3.1
ts-node 10.9.2
node v20.11.1
npm 10.2.4
🔬 How could we reproduce it?
- Install angular 17.2.0 with -> npm -g install @angular/cli@17.2.0
- Create a new project -> ng new cucumber-test
- Install additional modules
cd cucumber-test
npm install --save-dev @cucumber/cucumber ts-node
- Edit the project package.json and add a new script to run cucumber.
"cucumber": "./node_modules/@cucumber/cucumber/bin/cucumber-js ./cucumber/**/*.feature --no-strict --require-module ts-node/register --require ./cucumber/**/*.step.ts --tags @NIF05.01"
- Create a new feature with tag @NIF05.01->cucumber/features/NIF05.feature
@NIF05 @DashboardHome
Feature: [NIF05]-Fetch data
@NIF05 @NIF05.01
Scenario: [NIF05.01]-Get the initial set of data.
| uniqueId | accountId |
| 93813310 | 93813310 |
When the ESI endpoint "Get Mining Data" is called
Then the result is "200 OK"
- Run cucumber to get the steps for the new feature steps.
- Create the step file->cucumber/steps/NIF05.step.ts with the generated stubs
import { Given, When, Then } from "@cucumber/cucumber"
When('the ESI endpoint {string} is called', function (string) {
// Write code here that turns the phrase above into concrete actions
return 'pending'
})
Then('the result is {string}', function (string) {
// Write code here that turns the phrase above into concrete actions
return 'pending'
})
📚 Any additional context?
The example executions have been done after following instructions for Typescript found at page https://github.com/cucumber/cucumber-js/blob/main/docs/transpiling.md
Metadata
Metadata
Assignees
Labels
No labels