-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Mocha BDD wrapping incorrectly for it.only #2302
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
Comments
Do yo have a reduced test case demonstrating the actual problem you are experiencing? |
To clarify: I need a reproducible test case (selenium-webdriver only, no protractor stuff) to know what I'm looking for. Everything I've tried with |
I couldn't reproduce it as well with selenium-webdriver only, without protractor. |
Ok, I'm closing this because the supposed issue cannot be reproduced. For the record, selenium-webdriver does not monkey-patch mocha. It provides an API shim that wraps your functions before calling var test = require('selenium-webdriver/testing');
var assert = require('assert');
describe('wrapping', function() {
it('does not monkey-patch', function() {
assert.ok(test.it !== global.it);
assert.ok(test.it.only !== global.it.only);
console.log('test.it.only:______________');
console.log(test.it.only + '');
console.log();
console.log('it.only:______________');
console.log(it.only + '');
});
});
|
As always, we can revisit this issue if a reproducible test case is provided. |
Bother, you're right, this isn't patching -- I misread the exporting of wrapped versions of the functions as replacing the global ones (which in fact it's not doing) when I was trying to understand the reports we were getting pointing at the Selenium wrapper to explain the behavioral differences... But that can't be it since it's just exporting the wrapped functions, not replacing the originals with them. My bad, sorry about that! I'm thinking, at this point, that unless somebody comes up with a Selenium-only (no Protractor) test demonstrating a problem with Selenium's wrapped In fact, while Protractor does appear to be using Selenium's wrapped versions (replacing most of Mocha's global functions with them -- this is what I went looking for on a hunch once I realized what Selenium itself doesn't do the global replacement), it looks like it goes out of its way to keep the original Thanks for pointing me back in the right direction! |
@jleyba Sorry for the delay - and thanks a lot for your feedback I agree with @ScottFreeCode - it's a protractor issue since mocha "it.only" no more uses "global.it" |
Well, I eventually ended up having to try it in a VM in order to properly test it because my copy of Firefox wasn't cooperating with WebDriver, but I finally managed to confirm that Selenium's |
Meta -
OS: Windows 7
Selenium Version: 2.53.2
Mocha version : 2.5.3
Expected Behavior -
"it.only" function inside javascript/node/selenium-webdriver/testing/index.js should correctly wrapped for asynchronous code.
Actual Behavior -
Since mocha V2.4.1 and this commit "it.only" function is not correctly wrapped because it call original "it" mocha function and no more "it" wrapped function. So, test is not run in asynchronous mode.
mocha issue : https://github.com/mochajs/mocha/issues/2157
Now using own
it.only
function is necessary instead of wrapping.The text was updated successfully, but these errors were encountered: