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

Skipping a large amount of tests results in "Invalid string length" error #94

Closed
cutig3r opened this issue Nov 18, 2016 · 4 comments
Closed

Comments

@cutig3r
Copy link

cutig3r commented Nov 18, 2016

Skipping a variable number of tests fails depending on the amount of text contained within the body of the it().
Allowing all of the tests to succeed/fail does not have this issue.

Error Message:

Problem with mochawesome: RangeError: Invalid string length
at join (native)
at Object.stringify (native)
at stringify (C:\node\mochawesome-error\node_modules\json-stringify-safe\stringify.js:5:15)
at Runner. (C:\node\mochawesome-error\node_modules\mochawesome\lib\mochawesome.js:111:20)
at emitNone (events.js:91:20)
at Runner.emit (events.js:185:7)
at C:\node\mochawesome-error\node_modules\mocha\lib\runner.js:813:12
at C:\node\mochawesome-error\node_modules\mocha\lib\runner.js:661:9
at next (C:\node\mochawesome-error\node_modules\mocha\lib\runner.js:295:14)
at Immediate. (C:\node\mochawesome-error\node_modules\mocha\lib\runner.js:339:5)
at runCallback (timers.js:637:20)
at tryOnImmediate (timers.js:610:5)
at processImmediate [as _immediateCallback] (timers.js:582:5)

I have a sample attached to reproduce the issue.
1 dynamic it function (called 250 times) within one describe.
Each it has a 32 line body (including comments)

mochawesome-error.tar.gz

platform: Windows 7 x64
mocha version: 3.1.2
mochawesome version: 1.5.3
mocha called via cli npm test
alternatively mocha --reporter mochawesome --reporter-options autoOpen=true

@cutig3r
Copy link
Author

cutig3r commented Nov 18, 2016

This seems to be the related to the error that was resolved in issue #33

@cutig3r
Copy link
Author

cutig3r commented Nov 18, 2016

This may be able to be resolved by changing mochawesome.js line 86

from allPending: allPending,
to allPending: allPending.map(cleanTest),

@cutig3r
Copy link
Author

cutig3r commented Nov 18, 2016

That does look like it fixes the issue.
See my gist for the fix and update to mem-test.js. The gist contains a comment at the bottom explaining the changes
(I'm not familiar with how to post my changes for review, so i created a gist)

@adamgruber
Copy link
Owner

@cutig3r Thanks for finding this and figuring out the fix. I made the change and released 1.5.4 with the fix.

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

No branches or pull requests

2 participants