diff --git a/src/main/proxy-guarded-fetch-call-site-audit.test.ts b/src/main/proxy-guarded-fetch-call-site-audit.test.ts index 6ed1e52fd8b..ab13e610fa3 100644 --- a/src/main/proxy-guarded-fetch-call-site-audit.test.ts +++ b/src/main/proxy-guarded-fetch-call-site-audit.test.ts @@ -24,9 +24,12 @@ const AUDITED_NON_NET_FETCH_CALLS = new Map([ ]) // `globalThis.fetch` / `global.fetch` belong to global-fetch-call-site-audit.test.ts. -const NON_NET_FETCH_CALL = /(? { it('keeps every non-default-session fetcher audited with its expected count', () => { const found = new Map() for (const { file, content } of sources) { - const hits = [...content.matchAll(NON_NET_FETCH_CALL)].length + const hits = [...content.matchAll(FETCH_CALL)].filter((match) => { + const receiver = RECEIVER_IDENTIFIER.exec(content.slice(0, match.index))?.[1] + // A chained (`session.fromPartition(...).fetch(`) or member (`ctx.session.fetch(`) + // receiver has no bare trailing identifier, and is never the default session. + return receiver === undefined || !DEFAULT_SESSION_RECEIVERS.has(receiver) + }).length if (hits > 0) { found.set(file, hits) }