Note that there are some explanatory texts on larger screens.

plurals
  1. POCucumber JS can see my feature, but doesn't seem to run the steps
    text
    copied!<p>I've set up Cucumber-JS and Grunt-JS within my solution.</p> <p>My folder structure looks like this:</p> <pre><code>+ Project + features - Search.feature + step_definitions - Search_steps.js + support - world.js - package.json - gruntfile.js </code></pre> <p>I've added a Cucumber-JS task in gruntfile.js:</p> <pre><code>// Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), cucumberjs: { src: 'features', options: { steps: 'features/step_definitions', format: 'pretty' } } }); grunt.loadNpmTasks('grunt-cucumber'); grunt.registerTask('default', ['cucumberjs']); </code></pre> <p>And I've written out my feature file:</p> <pre><code>Feature: Search As a user of the website I want to search So that I can view items Scenario: Searching for items Given I am on the website When I go to the homepage Then I should see a location search box </code></pre> <p>And my step definition file:</p> <pre><code>var SearchSteps = module.exports = function () { this.World = require('../support/world').World; this.Given('I am on the website', function(callback) { callback.pending(); }); this.When('I go to the homepage', function (callback) { callback.pending(); }); this.Then('I should see a location search box', function (callback) { callback.pending(); }); }; </code></pre> <p>And my world.js file:</p> <pre><code>var World = function (callback) { callback(this); }; exports.World = World; </code></pre> <p>But when I run grunt at the command-line, while it seems to see my features, it never seems to run any of the steps.</p> <p>All I get is this:</p> <pre><code>Running "cucumberjs:src" (cucumberjs) task Feature: Search Scenario: Searching for items Given I am on the website When I go to the homepage Then I should see a location search box 1 scenario (1 pending) 3 steps (1 pending, 2 skipped) Done, without errors. </code></pre> <p>Cucumber doesn't seem to pay any attention to what I put inside the tests.</p> <p>Even if I put some obvious logical bug in, e.g.:</p> <pre><code>this.Given('I am on the website', function(callback) { var x = 0 / 0; callback.pending(); }); </code></pre> <p>It just ignores it and prints the above message.</p> <p>The only way I can seem to get any error out of Cucumber is to put an outright syntax error in the step file. E.g. remove a closing bracket. Then I get something like this:</p> <pre><code>Running "cucumberjs:src" (cucumberjs) task C:\dev\Project\features\step_definitions\Search_steps.js:14 }; ^ Warning: Unexpected token ; Use --force to continue. Aborted due to warnings. </code></pre> <p>What am I missing here?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload