Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code snippets are no longer in a valid format 2.0.0-rc.5 #710

Closed
john-mclean opened this issue Dec 29, 2016 · 3 comments
Closed

Code snippets are no longer in a valid format 2.0.0-rc.5 #710

john-mclean opened this issue Dec 29, 2016 · 3 comments

Comments

@john-mclean
Copy link

The code snippets, and subsequently all step definition files, are no longer valid.

The CHANGELOG.md indicates this change happened with 2.0.0-rc.4:

2.0.0-rc.4 (2016-12-19)

Breaking Changes

  • update support code library interface - instead of exporting a function and calling methods on this, require the cucumber module and call defineSupportCode which passes an object as the first argument whch exposes the methods. Overriding the world constructor has changed from overriding the World property to calling setWorldConstructor.
    // 1.3.1
    module.exports = function () {
      this.Given(/^a step$/, function() {});
      this.World = CustomWorld
    });
    
    // 2.0.0
    var {defineSupportCode} = require('cucumber');
    
    defineSupportCode(function({Given, setWorldConstructor}) {
      Given(/^a step$/, function() {});
      setWorldConstructor(CustomWorld);
    });

Uploading .feature files is not supported on github, so I have appended .txt to the feature file.
test.feature.txt

Sample output:

$ ./node_modules/cucumber/bin/cucumber.js -v
2.0.0-rc.5

$ ./node_modules/cucumber/bin/cucumber.js
Feature: test cucumber

As a test engineer
I want cucumber to provide valid code snippets
So that I can write valid step definitions

Scenario: A simple test
? Given I have a test with no step definition
? When I execute the test
? Then I receive a valid code snippet

Warnings:

  1. Scenario: A simple test - features/test.feature:8
    Step: Given I have a test with no step definition - features/test.feature:9
    Message:
    Undefined. Implement with the following snippet:

    this.Given('I have a test with no step definition', function (callback) {
      // Write code here that turns the phrase above into concrete actions
      callback(null, 'pending');
    });
    
  2. Scenario: A simple test - features/test.feature:8
    Step: When I execute the test - features/test.feature:10
    Message:
    Undefined. Implement with the following snippet:

    this.When('I execute the test', function (callback) {
      // Write code here that turns the phrase above into concrete actions
      callback(null, 'pending');
    });
    
  3. Scenario: A simple test - features/test.feature:8
    Step: Then I receive a valid code snippet - features/test.feature:11
    Message:
    Undefined. Implement with the following snippet:

    this.Then('I receive a valid code snippet', function (callback) {
      // Write code here that turns the phrase above into concrete actions
      callback(null, 'pending');
    });
    

1 scenario (1 undefined)
3 steps (3 undefined)
0m00.000s

@charlierudolph
Copy link
Member

Thanks for reporting this!

@charlierudolph
Copy link
Member

Released in 2.0.0-rc.6

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants