mochajs / mocha

β˜•οΈ simple, flexible, fun javascript test framework for node.js & the browser

Home Page:https://mochajs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ› Bug: Failed to run tests with a large tests count

sanchezzzhak opened this issue Β· comments

Bug Report Checklist

  • I have read and agree to Mocha's Code of Conduct and Contributing Guidelines
  • I have searched for related issues and issues with the faq label, but none matched my issue.
  • I have 'smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, my usage of Mocha, or Mocha itself.
  • I want to provide a PR to resolve this

Expected

I am trying to run tests in the amount of 74,800. but I get an error

#
# Fatal error in , line 0
# Fatal JavaScript invalid size error 174895934 (see crbug.com/1201626)
#
#
#
#FailureMessage Object: 0x7ffdea17c440
 1: 0xd17f41  [/home/atutik/.nvm/versions/node/v20.10.0/bin/node]
 2: 0x20fe211 V8_Fatal(char const*, ...) [/home/atutik/.nvm/versions/node/v20.10.0/bin/node]
 3: 0x1090db8  [/home/atutik/.nvm/versions/node/v20.10.0/bin/node]
 4: 0x127023f  [/home/atutik/.nvm/versions/node/v20.10.0/bin/node]
 5: 0x12703da  [/home/atutik/.nvm/versions/node/v20.10.0/bin/node]
 6: 0x14e9876 v8::internal::Runtime_GrowArrayElements(int, unsigned long*, v8::internal::Isolate*) [/home/atutik/.nvm/versions/node/v20.10.0/bin/node]
 7: 0x790753ed9ef6 

If run 73k tests, then everything works

Minimal, Reproducible Example

you can reproduce the problem like this

git clone git@github.com:sanchezzzhak/node-device-detector.git
npm i
node tests/tools/update-fixtures.js
npx mocha tests/*.spec.js

Versions

mocha 10.3.0 or 9.1.3
node 20.10.0

Additional Info

No response

I found the reason by downgrading the node js version, which showed that there is an infinite loop for test functions.
There is no problem.