From f64c8f05dd84deccae59b156023b1d88f1a93548 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Tue, 30 Jan 2024 19:56:48 +0100 Subject: [PATCH] test: fix path issue and refactoring --- README.md | 4 ++-- package.json | 2 +- test/common.test.ts | 4 ++-- test/src/.env.example | 1 + test/src/entities.ts | 3 ++- 5 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 test/src/.env.example diff --git a/README.md b/README.md index e6ff3897..91d278b7 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,8 @@ To run CLI tests for zksync-cli do the following: 1. Go to [test](`./test`) folder 2. Run `npm i` and install zksync-cli `npm i zksync-cli` 3. Make sure you have [Docker](https://docs.docker.com/engine/install/) on your system. -4. Make sure you have `.env` file with your wallet private key in `./test/src/` dir. Key is `E2E_TESTNET_PK`. It may looks like `E2E_TESTNET_PK=012345...abcdef` -5. Run `npm test` +4. Rename `.env.example` to `.env` in `./test/src/` dir and add your wallet private key to this file. F.e.: It may looks like `E2E_TESTNET_PK=012345...abcdef` +5. Run `npm run test` ## 🌍 Official Links diff --git a/package.json b/package.json index 6734bf1e..753b76c0 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "typecheck": "tsc -p . --noEmit", "lint": "eslint . --ext ./{src,test}/* --fix --ignore-path .gitignore --no-error-on-unmatched-pattern --max-warnings=0", "commitlint": "commitlint --edit", - "test": "jest" + "test": "jest --verbose" }, "keywords": [ "zksync", diff --git a/test/common.test.ts b/test/common.test.ts index f78f21c4..4323e8d8 100644 --- a/test/common.test.ts +++ b/test/common.test.ts @@ -129,10 +129,10 @@ describe("Check wallet balance of specified address", () => { }); //id1718 -xdescribe("Specific package can be updated using zksync-cli dev update ", () => { +xdescribe("Specific package can be updated using zksync-cli dev update module name", () => { // need to find out the way how to make "npx zksync-cli dev start" - it("npx zksync-cli dev update ", () => { + it("npx zksync-cli dev update module", () => { const command = "npx zksync-cli dev update zkcli-portal"; const result = executeCommand(command); expect(result.output).toMatch(/(Updating module)/i); diff --git a/test/src/.env.example b/test/src/.env.example new file mode 100644 index 00000000..d1102d6c --- /dev/null +++ b/test/src/.env.example @@ -0,0 +1 @@ +E2E_TESTNET_PK= diff --git a/test/src/entities.ts b/test/src/entities.ts index 63e6e559..77961189 100644 --- a/test/src/entities.ts +++ b/test/src/entities.ts @@ -1,6 +1,7 @@ import * as dotenv from "dotenv"; +import * as path from "path"; -dotenv.config(); +dotenv.config({path: path.resolve(__dirname, ".env")}); export const adresses = { sepoliaTestnet: "0x52B6d10d7d865B3d4103f8809AA3521288568f46",