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

TypeError: Cucumber.Cli is not a function #64

Closed
meettejender opened this issue Nov 30, 2016 · 17 comments
Closed

TypeError: Cucumber.Cli is not a function #64

meettejender opened this issue Nov 30, 2016 · 17 comments

Comments

@meettejender
Copy link

meettejender commented Nov 30, 2016

Hi Matt,

I am unable to resolve the below issue...
Please advise. Thanks

[10:54:43] I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
[10:54:43] I/launcher - Running 1 instances of WebDriver
[10:54:46] E/launcher - Error: TypeError: Cucumber.Cli is not a function
at C:\Users\uru\AppData\Roaming\npm\node_modules\protractor-cucumber-framework\ind
ex.js:31:16
at Function.promise (C:\Users\uru\AppData\Roaming\npm\node_modules\q\q.js:682:9)
at C:\Users\uru\AppData\Roaming\npm\node_modules\protractor-cucumber-framework\ind
ex.js:24:14
at _fulfilled (C:\Users\uru\AppData\Roaming\npm\node_modules\protractor\node_modul
es\q\q.js:834:54)
at self.promiseDispatch.done (C:\Users\uru\AppData\Roaming\npm\node_modules\protra
ctor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Users\uru\AppData\Roaming\npm\node_modules
protractor\node_modules\q\q.js:796:13)
at C:\Users\uru\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:55
6:49
at runSingle (C:\Users\uru\AppData\Roaming\npm\node_modules\protractor\node_module
s\q\q.js:137:13)
at flush (C:\Users\uru\AppData\Roaming\npm\node_modules\protractor\node_modules\q
q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
[10:54:46] E/launcher - Process exited with error code 100

Below is conf.js file i am using...

//protractor.conf.js
exports.config = {
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
getPageTimeout: 60000,
allScriptsTimeout: 500000,
framework: 'custom',
// path relative to the current config file
//frameworkPath: require.resolve('C:/Users/uru/AppData/Roaming/npm/node_modules/protractor-cucumber-framework'),
frameworkPath: 'C:/Users/uru/AppData/Roaming/npm/node_modules/protractor-cucumber-framework',
capabilities: {
'browserName': 'chrome'
},

// Spec patterns are relative to this directory.
specs: [
'D:/tractor/features/*.feature'
],

baseURL: 'https://angularjs.org/',

cucumberOpts: {
require: 'D:/tractor/features/step_definitions/my_step_definitions.js',
tags: false,
format: 'pretty',
profile: false,
'no-source': true
}
};

@mikklaos
Copy link

Vote up on this one. Got same error and stuck. Only way to get this working is to use older version of cucumber for me it worked with v.0.9.1

@meettejender
Copy link
Author

Thanks, got this resolved by using the older version of cucumber

@mikklaos
Copy link

mikklaos commented Dec 1, 2016

I don't know if you should close this, because the bug still exists. Only now workaround is possible.

@meettejender meettejender reopened this Dec 2, 2016
@sri85
Copy link

sri85 commented Dec 14, 2016

I ran into this issue yesterday , downgrading the version was the only option.

@willievaldez
Copy link

Same issue. We would like to use the new version of cucumber, but can't without an updated version of this package

@igniteram
Copy link

igniteram commented Dec 17, 2016

@darrinholst @mattfritz cucumber 2.0.0 has some breaking changes to the cucumber cli changelog.md.This is breaking protractor-cucumber-framework with this cucumber version. I just had a look at the code , Cli.run function no longer accepts a callback.

@darrinholst
Copy link
Contributor

yeah...I've been avoiding upgrading cucumber until someone fixed it. 😉

@darrinholst
Copy link
Contributor

I've started work in supporting cucumber 2 here. If any of you can pull this repo in and report back on whether everything is working I'll put a PR together.

    "cucumber": "2.0.0-rc.4",
    "protractor-cucumber-framework": "darrinholst/protractor-cucumber-framework#cucumber-2",

@igniteram
Copy link

@darrinholst Sure I am on it, in fact i was planning to work on this anyways let me help you in evaluating!

@willievaldez
Copy link

@darrinholst I tried implementing your cucumber2 branch but now all of the steps are marked as undefined. It seems that there's an issue with the framework resolving the path for step definitions. Perhaps it's just my project though, I'm not sure

@darrinholst
Copy link
Contributor

The way you define steps isn't backwards compatible within cucumber. You might be running into that. Details are here along with the rest of the breaking changes.

@igniteram
Copy link

@g2valdez Writing step definitions have changed from cucumber 2 version. These are some breaking changes, even the cucumber CLI has tons of breaking changes. For starters now you have to import defineSupportCode function :

var {defineSupportCode} = require('cucumber');
    
defineSupportCode(function({Given}) {
   
 Given(/^I am on google page$/, function () {
        return expect(browser.getTitle()).to.eventually.equal('Google');
    });
})    

@darrinholst I have tried running with latest cucumber version and the PR is working for me. However I haven't tried running all scenarios. Also if its fine I could write some example specs with new version and send a PR?

@darrinholst
Copy link
Contributor

It'd be nice if we could figure out a way to test both/all versions of cucumber in the same branch and test suite. I didn't pursue that at all. I'm guessing that there is and will be a lot of legacy projects depending on cucumber 1 support.

Either that or we decide to cut over to version 2 exclusively here and bump the major version on this module.

@igniteram
Copy link

The first option makes much sense as cucumber 2.0 is still in RC phase and I see lot of projects depend on cucumber 1, I suppose we would have to test both the versions, any suggestions to achieve it would help actually!

@Jordyderuijter
Copy link

Hi there guys,

What is the current progress on this issue?
Thanks in advance!

@mattbrunetti
Copy link
Collaborator

@darrinholst @igniteram two subdirectories, each with their own package.json specifying a different version of cucumber? Then require('cucumber') would resolve to different versions depending on which subdirectory it's in. I'll try this out tomorrow if I have time.

@darrinholst
Copy link
Contributor

This has been fixed with v1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants