Webstorm, methods from contracts are not recognized in Mocha tests (JS files).


When building Mocha tests on JS files, the methods (e.g. retrieve()) from the contracts (e.g. simpleStorage) are not recognized by Webstorm.

I'll get an alert by Webstorm saying "Unresolved function or method retrieve() "

Is there something I can do about this?

beforeEach(async function () {
simpleStorageFactory = await ethers.getContractFactory("SimpleStorage");
simpleStorage = await simpleStorageFactory.deploy();


it("Should start with a favorite number of 0", async function () {
const currentValue = await simpleStorage.retrieve();
const expectedValue = "0";
assert.equal(currentValue.toString(), expectedValue);

Thank you!




Comment actions Permalink

What do the methods (ethers.getContractFactory("SimpleStorage"), etc.) definitions look like? Please share full, self-containing code snippets the issue can be repeated with

Comment actions Permalink

Looks as if you are working with Solidity contracts. WebStorm has no support for it. This can be a feature request for the Solidity plugin. Please submit it to the plugin vendor, https://github.com/intellij-solidity/intellij-solidity/issues

Comment actions Permalink

Hi Elena,

thank you very much for your suggestion. I'll do so.



Please sign in to leave a comment.