Skip to content

infinite loop with nested .only() #2417

@adamjmurray

Description

@adamjmurray

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions