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

RangeError: Maximum call stack size exceeded #1284

Closed
asapach opened this issue Jun 6, 2018 · 4 comments
Closed

RangeError: Maximum call stack size exceeded #1284

asapach opened this issue Jun 6, 2018 · 4 comments
Labels
Component: Core For module, test, hooks, and runner. Type: Bug

Comments

@asapach
Copy link

asapach commented Jun 6, 2018

Tell us about your runtime:

  • QUnit version: 2.6.1
  • What environment are you running QUnit in? (e.g., browser, Node): browser (Chrome) and Node
  • How are you running QUnit? (e.g., script, testem, Grunt): either via cli, or karma-qunit, or in the browser

What are you trying to do?

We have a fairly large test suite with several thousand tests in it and with latest QUnit it takes forever to start and eventually it seems to run into a fairly impressive recursive call. This repro is an over-simplified version:

for (let i = 0; i < 100; i++) {
    QUnit.module('suite' + i, {
        beforeEach: function () {
            // do something
        },
        afterEach: function () {
            // do something
        }
    });

    for (let j = 0; j < 100; j++) {
        QUnit.test('test' + j, function (assert) {
            assert.ok(j !== 98);
        });
    }
}

What did you expect to happen?

All test suites should finish and report the results.

What actually happened?

QUnit fails before finishing the test run with the following exception:

Uncaught RangeError: Maximum call stack size exceeded
    at Array.join (native)
    at extractStacktrace (qunit.js:1074)
    at Test.run (qunit.js:1518)
    at qunit.js:1737
    at advanceTaskQueue (qunit.js:1129)
    at advance (qunit.js:1110)
    at advanceTestQueue (qunit.js:1155)
    at advance (qunit.js:1113)
    at advanceTestQueue (qunit.js:1155)
    at advance (qunit.js:1113)
@asapach
Copy link
Author

asapach commented Jun 6, 2018

The issue seems to have been introduced in v2.6.0

@trentmwillis
Copy link
Member

Thanks for the report and reproduction! Definitely sounds like a bug. It was probably introduced with #1260.

@gkatsev
Copy link

gkatsev commented Jan 7, 2019

Just noticed that 2.9.1 is out (thanks greenkeeper!) and I made a test branch that throws an error it seems to be fixed in it.

@Krinkle
Copy link
Member

Krinkle commented Oct 4, 2019

I can't reproduce this on qunit 2.9.2.

nobody@fresh$ qunit --version
2.9.2

nobody@fresh$ time qunit tmp.js
…
ok 9998 suite99 > test97
not ok 9999 suite99 > test98
  ---
  message: "failed, expected argument to be truthy, was: false"
  severity: failed
  actual: false
  expected: true
  stack:     at Object.<anonymous> (/Temp/tmp.js:13:20)
  ...
ok 10000 suite99 > test99
1..10000
# pass 9900
# skip 0
# todo 0
# fail 100

real	0m3.127s

It has the expected failure, and completes the ~ 10,000 times in about 3 seconds (this is inside a container, would presumably be quicker outside of that).

@Krinkle Krinkle closed this as completed Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core For module, test, hooks, and runner. Type: Bug
Development

No branches or pull requests

4 participants