Introduction to Unit Testing

Welcome to the forum discussion for this section. Here you can ask questions or post feedback.

Hey guys,

I’m experiencing a problem as I try to run the first unit test - file compilation is fine though. I get the following error:

Any recommendations are welcome! Thanks!

1 Like

Problem solved. Had to delete some lines of code in runner.js file - one of the files in truffle documentation.

Read this blog post for more info: https://github.com/mochajs/mocha/issues/4009

1 Like

Awesome! I’m glad you solved it :slight_smile: Let me know if you have more issues.

1 Like

Hi. Can you please be more specific on how to solve this issue? I tried the link you attached, but I can`t find the solution. :thinking:

Thanx.
Ivo

Hey,

You have to find runner.js file (mocha library file) and delete 3 lines of code. The code is either at the given lines, or further on at line 900 smth.

:

.

Hope that helps!

1 Like

Hi @ivga80,

I had the same error. “TypeError [ERR_INVALID_REPL_INPUT]: Listeners for uncaughtException…”
If the changes in the runner.js file does not help you to run mocha test, like in my case. You can also consider to downgrade Node if you already have the new Node version 12.
It looks like that there is still a problem with the current Node version 12.14 and the mocha/truffle setup. It helped me to uninstall the current Node version and reinstall Node version 10.18. https://nodejs.org/download/release/v10.18.0/
This works fine for me.
image

Hope you can get it to run in one or the other way. :slight_smile:

2 Likes

Hi @Paultier Thank you very much!
I just fixed the problem by downloading the msi file in the link you provided!

2 Likes

I can confirm node v12.14.1 still produces the above error and as Paultier pointed out v10.18.0 works dandy. These kind of node version related errors are common. I finally broke down and installed Node Version Manager (NVM). This allows you to install multiple versions of node and switch between them with a command line call:

NVM Windows:

NVM (Mac/Linux):

EDIT: note you’ll need to reinstall truffle after using NVM as the global utilities are linked to specific versions of node after doing this.

2 Likes