I know this question has an answer, but the answers on that post does not clarify things for me as I did exactly as the answers suggested:
My inbox.test.js
file from six years ago had the following require statements:
const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
To how it should be done now:
const assert = require("assert");
const ganache = require("ganache");
const { Web3 } = require("web3");
const provider = ganache.provider();
const web3 = new Web3(provider);
But when I run my test, for this line: const web3 = new Web3(provider);
I get Web3 is not a constructor
. So I know what its saying, but then if I cannot use new Web3()
, what syntax am I supposed to user now?