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

infinite loop with nested .only() #2417

Closed
adamjmurray opened this issue Aug 4, 2016 · 1 comment · Fixed by #2419
Closed

infinite loop with nested .only() #2417

adamjmurray opened this issue Aug 4, 2016 · 1 comment · Fixed by #2419

Comments

@adamjmurray
Copy link

Run the following test through mocha 3.0.1:

var assert = require('assert');

describe('Array', function() {

  describe.only('.push()', function() {

    it.only('appends a value to the end of the array', function() {
      var array = [1];
      array.push(2);
      assert.deepEqual(array, [1, 2]);
    });
  });
});

Mocha exits with an exception that seems to indicate an infinite loop occurred:

RangeError: Maximum call stack size exceeded
    at filterOnly (/Users/adam/workspace/cirrus/node_modules/mocha/lib/runner.js:857:23)
    at /Users/adam/workspace/cirrus/node_modules/mocha/lib/runner.js:861:9
    at Array.forEach (native)
    at filterOnly (/Users/adam/workspace/cirrus/node_modules/mocha/lib/runner.js:857:23)
    at /Users/adam/workspace/cirrus/node_modules/mocha/lib/runner.js:861:9
    at Array.forEach (native)
    at filterOnly (/Users/adam/workspace/cirrus/node_modules/mocha/lib/runner.js:857:23)
    ...

This is a simplified example. In practice, I sometimes focus on getting a single it.only() test passing, and then go "up a level" and test a group of related tests via a describe.only() block.

Not a blocker. Workaround: don't use nested .only()

@not-an-aardvark
Copy link
Contributor

Can reproduce. The issue is that the suite is attempting to filter its own only suites here, rather than its children's only suites. I'll make a PR.

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.

2 participants