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

Node ^12.3.0 REPL Support #4009

Closed
4 tasks done
CruzMolina opened this issue Sep 5, 2019 · 5 comments
Closed
4 tasks done

Node ^12.3.0 REPL Support #4009

CruzMolina opened this issue Sep 5, 2019 · 5 comments
Labels
status: no reproduction We couldn't figure out how to reproduce this. Please post a standalone issue.

Comments

@CruzMolina
Copy link

Prerequisites

  • Checked that your issue hasn't already been filed by cross-referencing issues with the faq label
  • Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • '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, your usage of Mocha, or Mocha itself
  • Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.

Description

As of Node 12.3.0, listeners for UncaughtExceptions throw an ERR_INVALID_REPL_INPUT when used within a REPL context.

Mocha 6.2.0 adds a listener here, appearing to make the lib unusable in Node ^12.3.0 REPL contexts. 5.2.0 adds one here.

Steps to Reproduce

$ npx truffle unbox metacoin
...
$ npx truffle dev
...
truffle(develop)> test                                                                                                                      

Expected behavior:

truffle(develop)> test

Compiling your contracts...
===========================
> Compiling ./contracts/ConvertLib.sol
> Compiling ./contracts/MetaCoin.sol
> Compiling ./contracts/Migrations.sol
> Compiling ./test/TestMetaCoin.sol



  TestMetaCoin
    ✓ testInitialBalanceUsingDeployedContract (64ms)
    ✓ testInitialBalanceWithNewMetaCoin (57ms)

  Contract: MetaCoin
    ✓ should put 10000 MetaCoin in the first account
    ✓ should call a function that depends on a linked library
    ✓ should send coin correctly (101ms)


  5 passing (5s)

Actual behavior:

truffle(develop)> test
                                                                                                                      
Compiling your contracts...
===========================
> Compiling ./contracts/ConvertLib.sol
> Compiling ./contracts/MetaCoin.sol
> Compiling ./contracts/Migrations.sol
> Compiling ./test/TestMetaCoin.sol

TypeError [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException` cannot be used in the REPL
    at process.<anonymous> (repl.js:224:15)
    at process.emit (events.js:214:15)
    at process.emit (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/build/webpack:/~/source-map-support/source-map-support.js:465:1)
    at _addListener (events.js:235:14)
    at process.addListener (events.js:283:10)
    at Runner.run (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:868:11)
    at Mocha.run (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:612:17)
    at /home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:116:1
    at new Promise (<anonymous>)
    at Object.run (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:115:1)     
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Reproduces how often:

100% of the time

Versions

  • The output of mocha --version and node node_modules/.bin/mocha --version: 5.2.0
  • The output of node --version: v12.9.0
  • Your operating system
    • name and version: macOS High Sierra 10.13.6
    • architecture (32 or 64-bit): 64-bit
  • Your shell (e.g., bash, zsh, PowerShell, cmd): zsh
  • Your browser and version (if running browser tests): N/A
  • Any third-party Mocha-related modules (and their versions): N/A
  • Any code transpiler (e.g., TypeScript, CoffeeScript, Babel) being used (and its version): N/A

Additional Information

When bumping truffle's mocha version to latest (6.2.0), the error is the same, albeit with the stack trace pointing to the different line in lib/runner.js.

When forking from 5.2.0, removing the listener and testing truffle bundled locally (same repro steps), the error goes away.

@fainashalts
Copy link

Hello! I wanted to check in on this issue and see if there is any interest in fixing it. Unfortunately Truffle is unusable on Node 12 because of the uncaughtException listener. We are working on possible solutions on our end but it would be nice if Mocha provided Node ^12.3.0 REPL Support out of the box. Thanks, let me know if I can help or clarify anything here!

@rafarodra
Copy link

Is there any updates on this change? If not, is there any workarounds to run truffle test?

I'm running:
Truffle v5.1.43 (core: 5.1.43)
Solidity - 0.6.2 (solc-js)
Node v12.18.2
Web3.js v1.2.1

@fainashalts
Copy link

@rafarodra for now you can downgrade to node 10 and Truffle test should work fine. The Truffle team has a fix incoming, currently in code review. Should be good to go in this week or next week’s release!

@rafarodra
Copy link

@rafarodra for now you can downgrade to node 10 and Truffle test should work fine. The Truffle team has a fix incoming, currently in code review. Should be good to go in this week or next week’s release!

Thanks for replying back. In the meantime, I set up Ganache to run 'Truffle test' to avoid downgrading Node. Thanks again.

@JoshuaKGoldberg
Copy link
Member

Given that truffle is being sunset (trufflesuite/truffle#6204 -> trufflesuite/truffle@5b5312d) and there's no standalone reproduction for this issue, I'm going to close it out.

If anybody needs Mocha to run in the Node REPL please do file a new issue with one of our new issue templates that includes a standalone reproduction we can use. Thanks!

@JoshuaKGoldberg JoshuaKGoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2024
@JoshuaKGoldberg JoshuaKGoldberg added status: wontfix typically a feature which won't be added, or a "bug" which is actually intended behavior status: no reproduction We couldn't figure out how to reproduce this. Please post a standalone issue. and removed unconfirmed-bug status: wontfix typically a feature which won't be added, or a "bug" which is actually intended behavior labels Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: no reproduction We couldn't figure out how to reproduce this. Please post a standalone issue.
Projects
None yet
Development

No branches or pull requests

4 participants