bencompton / jest-cucumber

Execute Gherkin scenarios in Jest
Apache License 2.0
662 stars 118 forks source link

SyntaxError: Cannot use import statement outside a module #160

Closed ThiagoMFerreira closed 7 months ago

ThiagoMFerreira commented 2 years ago

I am trying to use jest-cucumber but i am getting this error after create the .steps.js file and run the npm test command

({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { defineFeature, loadFeature } from 'jest-cucumber';
                                                                                      ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1678:14)

The .step.js file

 import { defineFeature, loadFeature } from 'jest-cucumber';

const feature = loadFeature('features/LoggingIn.feature');

defineFeature(feature, test => {
    test('add a product to cart', ({ given, when, then }) => {

    });
  });

npm test commad is justing calling jest

github-actions[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 7 months ago

This issue is closed because there has been no recent activity.