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

bug with dynamic skip functionality #1604

Closed
ghughal opened this issue Mar 16, 2015 · 8 comments
Closed

bug with dynamic skip functionality #1604

ghughal opened this issue Mar 16, 2015 · 8 comments
Labels
type: bug a defect, confirmed by a maintainer

Comments

@ghughal
Copy link

ghughal commented Mar 16, 2015

I'm getting error with using dynamic skip() functionality with asyn function. Is this a bug or I'm doing something wrong?

    it('should skip after callback', function(done){
        var self = this;
        var asyncFunc = function(cb) {
            setTimeout(cb, 1000);
        };

        asyncFunc(function() {
            self.skip();
            throw new Error('never thrown');
        });
    })

Here's error I'm getting:

  1) skip in test should skip after callback:
     Error: the object {
  "message": [undefined]
  "uncaught": true
} was thrown, throw an Error :)
      at Runner.fail (/usr/local/lib/node_modules/mocha/lib/runner.js:207:11)
      at Runner.uncaught (/usr/local/lib/node_modules/mocha/lib/runner.js:580:8)
      at process.uncaught (/usr/local/lib/node_modules/mocha/lib/runner.js:609:10)
      at process.EventEmitter.emit (events.js:95:17)
      at process._fatalException (node.js:272:26)
@ghughal ghughal changed the title issue with skip functionality bug with dynamic skip functionality Mar 16, 2015
@a8m
Copy link
Contributor

a8m commented Mar 16, 2015

It's seems like a bug.
I started to play with it, and I'll update later.
Thx @ghughal

@ghughal
Copy link
Author

ghughal commented Mar 17, 2015

Thanks @a8m

@danielstjules
Copy link
Contributor

@ghughal @a8m I don't think this behavior's ever been supported, but I submitted a possible solution for allowing it: #1618

@ghughal
Copy link
Author

ghughal commented Mar 25, 2015

Thank you @danielstjules

@boneskull boneskull added the type: bug a defect, confirmed by a maintainer label Apr 9, 2015
@ScottFreeCode
Copy link
Contributor

This should be fixed by #2335; can anyone confirm?

@maggiesavovska
Copy link

maggiesavovska commented Aug 1, 2016

I'm getting the following error:
"Converting circular structure to JSON"
it('should skip async test', function(done){ var self = this; driver.url('https://www.google.com').then(function(result){ self.skip(); }).catch(function(err){console.log('error', err.message)}); });

@ScottFreeCode
Copy link
Contributor

I just checked with the various versions of Mocha and confirmed that this issue from 2.x was fixed in 3.0. I also checked the PR and it added regression tests for this specific case, so this shouldn't come up again either. 🎆

@maggiesavovska I was unable to get a circular JSON error out of skip() in 2.x, 3.0 or current, using that particular test with Promise.resolve substituted for driver.url (or with any variations I could think of). Can you confirm whether you can still get that result in current Mocha and if so open a new issue including which library you're using for driver? (It also might be a duplicate of #2598, but we may as well take a look at your case before we reach such a conclusion.)

@maggiesavovska
Copy link

@ScottFreeCode: Yes, it's fixed in mocha@3.1.0. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

No branches or pull requests

6 participants