jest-cucumber icon indicating copy to clipboard operation
jest-cucumber copied to clipboard

autoBindSteps - Your test suite must contain at least one test.

Open cc-pragmea opened this issue 2 years ago • 1 comments

Hi, i'm running the ecmascript example you have for autobindsteps and i keep on getting the same error from Jest

https://github.com/bencompton/jest-cucumber/blob/master/examples/ecmascript/specs/step-definitions/auto-step-binding.steps.js

Jest version : 27.5.1 Jest-Cucumber version : 6.1.0

Command used : jest --config jest-feature-config.js

jest-feature-config.js :

module.exports = { testMatch: ["**/my.steps.js"] };

my.steps.js :

import { loadFeatures, autoBindSteps } from "jest-cucumber";

export const vendingMachineSteps = ({ given, and, when, then }) => {

given(/^the vending machine has "(.*)" in stock$/, itemName => {
console.log('given'); });

and("I have inserted the correct amount of money", () => { console.log('and'); });

when(/^I purchase "(.*)"$/, itemName => { console.log('when'); });

then(/^my "(.*)" should be dispensed$/, itemName => { console.log('then'); }); };

const features = loadFeatures("./my.feature");

autoBindSteps(features, [vendingMachineSteps]);

my.feature :

Feature: Snack vending machine

Scenario: Purchasing a snack
    Given the vending machine has "Maltesers" in stock
    And I have inserted the correct amount of money
    When I purchase "Maltesers"
    Then my "Maltesers" should be dispensed

Error :

● Test suite failed to run

Your test suite must contain at least one test.

  at onResult (node_modules/jest-cli/node_modules/@jest/core/build/TestScheduler.js:175:18)
  at node_modules/emittery/index.js:260:13
      at Array.map (<anonymous>)
  at Emittery.emit (node_modules/emittery/index.js:258:23)

Any idea why this is happening and how to fix it ? I've tried in many ways and always get the same result. This is really blocking and i don't understand why it's not working properly, Thanks

cc-pragmea avatar Jun 22 '22 16:06 cc-pragmea

Hi,

in my modest opinion, this line:

const features = loadFeatures("./my.feature");

is not finding the Feature File.

Try to verify the file location.

tonirecio avatar Oct 18 '22 11:10 tonirecio

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] avatar Mar 30 '24 01:03 github-actions[bot]

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

github-actions[bot] avatar Apr 06 '24 02:04 github-actions[bot]