From f1ae5a16398572f96fcc809b0c2e66159985635e Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Mon, 27 Sep 2021 11:08:14 +1000 Subject: [PATCH 1/2] test: Add debug logging --- packages/status-communities/src/messenger.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/status-communities/src/messenger.spec.ts b/packages/status-communities/src/messenger.spec.ts index fa93e2c..4df4eb5 100644 --- a/packages/status-communities/src/messenger.spec.ts +++ b/packages/status-communities/src/messenger.spec.ts @@ -1,4 +1,5 @@ import { expect } from "chai"; +import debug from "debug"; import { utils } from "js-waku"; import { ApplicationMetadataMessage } from "./application_metadata_message"; @@ -7,6 +8,8 @@ import { Messenger } from "./messenger"; const testChatId = "test-chat-id"; +const dbg = debug("communities:test:messenger"); + describe("Messenger", () => { let messengerAlice: Messenger; let messengerBob: Messenger; @@ -16,9 +19,12 @@ describe("Messenger", () => { beforeEach(async function () { this.timeout(10_000); + dbg("Generate keys"); identityAlice = Identity.generate(); identityBob = Identity.generate(); + dbg("Create messengers"); + [messengerAlice, messengerBob] = await Promise.all([ Messenger.create(identityAlice), Messenger.create(identityBob, { @@ -26,12 +32,14 @@ describe("Messenger", () => { }), ]); + dbg("Connect messengers"); // Connect both messengers together for test purposes messengerAlice.waku.addPeerToAddressBook( messengerBob.waku.libp2p.peerId, messengerBob.waku.libp2p.multiaddrs ); + dbg("Wait for pubsub connection"); await Promise.all([ new Promise((resolve) => messengerAlice.waku.libp2p.pubsub.once( @@ -45,6 +53,7 @@ describe("Messenger", () => { ) ), ]); + dbg("Messengers ready"); }); it("Sends & Receive public chat messages", async function () { From 208946f7567156170834172597c997df9ae15ddc Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Mon, 27 Sep 2021 11:08:41 +1000 Subject: [PATCH 2/2] ci: Enable test debug logging --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d70309..c136867 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,4 +17,4 @@ jobs: node-version: 14.x - run: yarn install --frozen-lockfile - run: yarn build - - run: yarn test + - run: DEBUG=communities:test* yarn test