From 53c00a7d78d92045f413ce769a607eb6d1d05a19 Mon Sep 17 00:00:00 2001 From: Herb Caudill Date: Mon, 4 Dec 2023 12:11:47 +0100 Subject: [PATCH 1/2] coverage hints --- .../src/StrongMessagePortRef.ts | 1 + .../src/WeakMessagePortRef.ts | 3 +++ packages/automerge-repo/src/helpers/pause.ts | 4 ++++ packages/automerge-repo/src/helpers/withTimeout.ts | 2 ++ packages/automerge-repo/src/network/NetworkAdapter.ts | 6 ++++-- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/automerge-repo-network-messagechannel/src/StrongMessagePortRef.ts b/packages/automerge-repo-network-messagechannel/src/StrongMessagePortRef.ts index 277a5d0da..87f7524d5 100644 --- a/packages/automerge-repo-network-messagechannel/src/StrongMessagePortRef.ts +++ b/packages/automerge-repo-network-messagechannel/src/StrongMessagePortRef.ts @@ -22,6 +22,7 @@ export class StrongMessagePortRef } isAlive(): boolean { + /* c8 ignore next */ return true } } diff --git a/packages/automerge-repo-network-messagechannel/src/WeakMessagePortRef.ts b/packages/automerge-repo-network-messagechannel/src/WeakMessagePortRef.ts index e790c8460..f173a630f 100644 --- a/packages/automerge-repo-network-messagechannel/src/WeakMessagePortRef.ts +++ b/packages/automerge-repo-network-messagechannel/src/WeakMessagePortRef.ts @@ -1,3 +1,4 @@ +/* c8 ignore start */ import { EventEmitter } from "eventemitter3" import { PortRefEvents, MessagePortRef } from "./MessagePortRef.js" @@ -68,3 +69,5 @@ export class WeakMessagePortRef return true } } + +/* c8 ignore end */ diff --git a/packages/automerge-repo/src/helpers/pause.ts b/packages/automerge-repo/src/helpers/pause.ts index b117e5d83..95f0779cf 100644 --- a/packages/automerge-repo/src/helpers/pause.ts +++ b/packages/automerge-repo/src/helpers/pause.ts @@ -1,3 +1,5 @@ +/* c8 ignore start */ + export const pause = (t = 0) => new Promise(resolve => setTimeout(() => resolve(), t)) @@ -12,3 +14,5 @@ export function rejectOnTimeout( }), ]) } + +/* c8 ignore end */ diff --git a/packages/automerge-repo/src/helpers/withTimeout.ts b/packages/automerge-repo/src/helpers/withTimeout.ts index 2a7517fe0..8a9e96f98 100644 --- a/packages/automerge-repo/src/helpers/withTimeout.ts +++ b/packages/automerge-repo/src/helpers/withTimeout.ts @@ -1,3 +1,4 @@ +/* c8 ignore start */ /** * If `promise` is resolved before `t` ms elapse, the timeout is cleared and the result of the * promise is returned. If the timeout ends first, a `TimeoutError` is thrown. @@ -26,3 +27,4 @@ export class TimeoutError extends Error { this.name = "TimeoutError" } } +/* c8 ignore end */ diff --git a/packages/automerge-repo/src/network/NetworkAdapter.ts b/packages/automerge-repo/src/network/NetworkAdapter.ts index e95a08656..4788707e2 100644 --- a/packages/automerge-repo/src/network/NetworkAdapter.ts +++ b/packages/automerge-repo/src/network/NetworkAdapter.ts @@ -1,13 +1,15 @@ +/* c8 ignore start */ + import { EventEmitter } from "eventemitter3" import { PeerId } from "../types.js" import { Message } from "./messages.js" import { StorageId } from "../storage/types.js" -/** +/** * Describes a peer intent to the system * storageId: the key for syncState to decide what the other peer already has * isEphemeral: to decide if we bother recording this peer's sync state - * + * */ export interface PeerMetadata { storageId?: StorageId From 1c41e4d1c5103ce892f76f806fb950b40b609e67 Mon Sep 17 00:00:00 2001 From: Herb Caudill Date: Mon, 4 Dec 2023 12:24:34 +0100 Subject: [PATCH 2/2] vitest: coverage config --- vitest.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/vitest.config.ts b/vitest.config.ts index 82caa3470..6a5de5091 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,6 +6,7 @@ export default defineConfig({ coverage: { provider: "v8", reporter: ["lcov", "text", "html"], + skipFull: true, exclude: [ "**/fuzz", "**/helpers",