Skip to content

docs: testing - info about hardhat-toolbox when using hardhat tests with localnet #495

@rube-de

Description

@rube-de

If a developer creates a new hardhat project, installs the default dependency hardhat-toolbox and want to run test/Lock.ts with sapphire-localnet it will fail, because the used hardhat-network-helpers are working only with the hardhat node.

Additionally the the @nomicfoundation/hardhat-chai-matchers will only work with view calls, not for sending transactions.

This info could be helpful in the docs for new Sapphire developers.

To test reverted transactions you could do e.g.:

      try {
        const tx = await box.connect(other).setSecretMessage("hacked");
        await tx.wait()        
      } catch (error) {
        expect(error.message).to.include("transaction execution reverted");
      }

It should be also considered if Localnet could return the revert reason, as it is visible in the Localnet Explorer

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions