0

I am trying to run a JS test script with truffles but I can not seem to find the right place to store the assertRevert file so that the module can be found by the script when I try to run the test.

const { assertRevert } = require('assertRevert');

Is that the top of my script.

The Error I am getting is Cannot find module 'assertRevert'

Thanks in advance !

9
  • Try require('assertRevert.js'), otherwise, node searches in its own installation path rather than in your local path. Commented Jul 31, 2018 at 12:31
  • Still not working. Where would you store the file in the test folder or main directory of the project ?
    – conwise17
    Commented Jul 31, 2018 at 12:46
  • Sorry, try require('./assertRevert.js'). Of course, if the file assertRevert.js is not located in the same path as your script, then use the correct relative path instead of ./. Commented Jul 31, 2018 at 13:36
  • Still no luck, any other ideas what could be going wrong ? The assetRevert file is in my test folder and still getting no luck.
    – conwise17
    Commented Aug 1, 2018 at 10:10
  • Do you properly export in that file? i.e., do you assign module.exports = ... somewhere? Also, why exactly do you do const { assertRevert } = ... with those curly braces? Seems like you're not entirely familiar with how to export JS code properly. There's a lot of information on that, and you probably want to search it on Stack Overflow, because it doesn't have anything to do specifically with Ethereum. Commented Aug 1, 2018 at 12:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.