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 !
require('assertRevert.js')
, otherwise, node searches in its own installation path rather than in your local path.require('./assertRevert.js')
. Of course, if the fileassertRevert.js
is not located in the same path as your script, then use the correct relative path instead of./
.module.exports = ...
somewhere? Also, why exactly do you doconst { 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.