I’m currently running the latest version of Hardhat on WSL. I installed the npm packages for hardhat toolbox as per the demonstration given by hardhat.
However, it shows some error which I don’t understand.
Initially, i was using ‘const’ and ‘require’ format. Then I changed to the ‘import’ format
Usually, imports() are used in ‘.mjs’ modules. So i thought maybe I had to change the ‘type’ to ‘module’. But that also did not work, as you can see in the third iteration.
Another interesting part is that the ‘node_modules/chai/index.mjs’ is already using an import statement!
Please guide me on what to do ahead.
Following is my script file.
// const {ethers} = require("hardhat")
// const {expect} = require("chai")
import {expect} from 'chai'
import {ethers } from 'hardhat'
describe("SafeHeiro Base Implementation", function(){
it("Should correctly assign the value '3' to 'Test' key", async function () {
const safeHeiro = await ethers.deployContract('safeHeiro')
await safeHeiro.waitForDeployment()
await safeHeiro.callThis()
expect(await safeHeiro.getValueOfThis()).to.equal(3)
})
})
3