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

handle-done-callback: wrongly detect done callback #205

Open
VinhVu0412 opened this issue Aug 16, 2019 · 2 comments
Open

handle-done-callback: wrongly detect done callback #205

VinhVu0412 opened this issue Aug 16, 2019 · 2 comments
Labels

Comments

@VinhVu0412
Copy link

I am using nightwatch with mocha, my test function look like this

it('uses BDD to run the Google simple test', function(browser) {
  browser
    .url('http://google.com')
    .expect.element('body').to.be.present.before(1000);

  browser.setValue('input[type=text]', ['nightwatch', browser.Keys.ENTER])
    .pause(1000)
    .assert.containsText('#main', 'Night Watch');
});

(More detail about using mocha with nightwatch is here)

When I check with eslint, it says
error Expected "browser" callback to be handled mocha/handle-done-callback

I am using

{
  "nightwatch": "^1.1.13",
  "mocha": "^6.2.0",
  "eslint": "^6.1.0",
  "eslint-plugin-mocha": "^6.0.0"
}

The checker thinks browser is done callback, but it's not.

@lo1tuma
Copy link
Owner

lo1tuma commented Aug 16, 2019

Mocha always expects the done callback parameter to be the first argument. The behavior of injecting the browser parameter is added by nightwatch and is not compatible with the default behavior of mocha.

That’s being said, I would be open for a change proposal that solves this kind of issues in a generic way (i.e. not nightwatch specific). Maybe something like adding a configuration option that allows you to specify the expected argument position.

@VinhVu0412
Copy link
Author

That sounds great. At this point of time, I'll stay with inline ignore.

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

No branches or pull requests

2 participants