Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: address feedback & remove old plugin
Browse files Browse the repository at this point in the history
sarahschwartz committed Jul 25, 2024
1 parent d6ff5e7 commit 1c6e63c
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions content/tutorials/how-to-test-contracts/10.index.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ description: Learn how to test your smart contracts locally using era-test-node

This tutorial provides a step-by-step guide on testing smart contracts using the `hardhat-chai-matchers` plugin
in conjunction with the **ZKsync Era Test Node** on your local machine.
To facilitate this process of running tests on the **ZKsync Era Test Node**, you'll also utilize the `hardhat-zksync-node` plugin.
To facilitate this process of running tests on the **ZKsync Era Test Node**, you'll also utilize the `hardhat-zksync` plugin.

## Prerequisites

@@ -16,7 +16,7 @@ To facilitate this process of running tests on the **ZKsync Era Test Node**, you
## Era-test-node plugin

In this tutorial, the contract functionality is tested using the [ZKsync Era Test Node](https://docs.zksync.io/build/test-and-debug/in-memory-node).
To start local node we use the `hardhat-zksync-node` plugin to integrate this functionality within the Hardhat project.
To start local node we use the `hardhat-zksync` plugin to integrate this functionality within the Hardhat project.

::callout{icon="i-heroicons-exclamation-triangle"}
During the alpha phase, ZKsync Era Test Nodes are currently undergoing development, wherein certain functionalities might not be fully supported or operational.
@@ -34,18 +34,18 @@ npx hardhat init

Select the `Create a TypeScript project` option and install the sample project's dependencies: `hardhat` and `@nomicfoundation/hardhat-toolbox`.

To install the `hardhat-zksync-node` plugin, execute the following command:
To install the `hardhat-zksync` plugin, execute the following command:

<span id="install-hh-zksync" data-name="runCommand" data-command-folder="tests-output/hardhat-project"></span>

::code-group

```bash [npm]
npm i -D @matterlabs/hardhat-zksync-node
npm i -D @matterlabs/hardhat-zksync
```

```bash [yarn]
yarn add -D @matterlabs/hardhat-zksync-node
yarn add -D @matterlabs/hardhat-zksync
```

::
@@ -56,7 +56,7 @@ Once installed, add the plugin at the top of your `hardhat.config.ts` file.
data-at-line="3"></span>

```ts [hardhat.config.ts]
import "@matterlabs/hardhat-zksync-node";
import "@matterlabs/hardhat-zksync";
```

### Starting the ZKsync Era Test Node
@@ -98,7 +98,7 @@ You should see output similar to this:
09:04:44 INFO ========================================
```

Since we've confirmed that the **ZKsync Era Test Node** is functioning properly with the help of the `hardhat-zksync-node` plugin,
Since we've confirmed that the **ZKsync Era Test Node** is functioning properly with the help of the `hardhat-zksync` plugin,
we can shut it down and continue with the tutorial.

### Integration with Hardhat
@@ -133,22 +133,21 @@ In the root directory of your project, execute this command:
::code-group

```bash [npm]
npm i -D @nomicfoundation/hardhat-chai-matchers [email protected] @matterlabs/hardhat-zksync
npm i -D @nomicfoundation/hardhat-chai-matchers [email protected]
```

```bash [yarn]
yarn add -D @nomicfoundation/hardhat-chai-matchers [email protected] @matterlabs/hardhat-zksync
yarn add -D @nomicfoundation/hardhat-chai-matchers [email protected]
```

::

After installing it, add the plugins at the top of your `hardhat.config.ts` file:
After installing it, add the plugin at the top of your `hardhat.config.ts` file:

<span id="import-chai-matchers" data-name="modifyFile" data-filepath="tests-output/hardhat-project/hardhat.config.ts"
data-at-line="4"></span>

```ts [hardhat.config.ts]
import "@matterlabs/hardhat-zksync";
import "@nomicfoundation/hardhat-chai-matchers";
```

@@ -159,7 +158,6 @@ With the previous steps completed, your `hardhat.config.ts` file should now be p
```ts [hardhat.config.ts]
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@matterlabs/hardhat-zksync-node";
import "@matterlabs/hardhat-zksync";
import "@nomicfoundation/hardhat-chai-matchers";

@@ -306,7 +304,7 @@ However, if you prefer to compile manually, simply run the following command `np

::

The `hardhat-zksync-node` plugin overrides the default behavior of the Hardhat `test` task.
The `hardhat-zksync` plugin overrides the default behavior of the Hardhat `test` task.
It starts the **ZKsync Era Test Node** before running tests, executes the tests,
and then automatically shuts down the node after the test cases are completed.

0 comments on commit 1c6e63c

Please sign in to comment.