diff --git a/packages/zone/test/async-flow/test-async-flow.js b/packages/zone/test/async-flow/test-async-flow.js index ec37b78159a2..abe29f216aa4 100644 --- a/packages/zone/test/async-flow/test-async-flow.js +++ b/packages/zone/test/async-flow/test-async-flow.js @@ -4,7 +4,6 @@ import { getBaggage, annihilate, nextLife, - asyncFlowVerbose, } from '../prepare-test-env-ava.js'; import { Fail } from '@endo/errors'; @@ -58,12 +57,9 @@ const firstLogLen = 7; * @param {any} t * @param {import('@agoric/base-zone').Zone} zone * @param {import('@agoric/vow').VowTools} vowTools - * @param {boolean} [showOnConsole] */ -const testFirstPlay = async (t, zone, vowTools, showOnConsole = false) => { - if (showOnConsole) { - t.log('firstPlay started'); - } +const testFirstPlay = async (t, zone, vowTools) => { + t.log('firstPlay started'); const { asyncFlow, adminAsyncFlow } = prepareAsyncFlowTools(zone, { vowTools, }); @@ -80,9 +76,7 @@ const testFirstPlay = async (t, zone, vowTools, showOnConsole = false) => { const { guestMethod } = { async guestMethod(gOrch7, gP) { t.is(this, 'context'); - if (showOnConsole) { - t.log(' firstPlay about to await gP'); - } + t.log(' firstPlay about to await gP'); await gP; const g2 = gOrch7.vow(); const prod = gOrch7.scale(3); @@ -97,9 +91,7 @@ const testFirstPlay = async (t, zone, vowTools, showOnConsole = false) => { t.is(gErr.name, 'TypeError'); resolveStep(true); - if (showOnConsole) { - t.log(' firstPlay to hang awaiting g2'); - } + t.log(' firstPlay to hang awaiting g2'); // awaiting a promise that won't be resolved until next incarnation await g2; t.fail('must not reach here in first incarnation'); @@ -135,9 +127,7 @@ const testFirstPlay = async (t, zone, vowTools, showOnConsole = false) => { TypeError('Cannot mix BigInt and other types, use explicit conversions'), ], ]); - if (showOnConsole) { - t.log('firstPlay done'); - } + t.log('firstPlay done'); return promiseStep; }; @@ -145,12 +135,9 @@ const testFirstPlay = async (t, zone, vowTools, showOnConsole = false) => { * @param {any} t * @param {import('@agoric/base-zone').Zone} zone * @param {import('@agoric/vow').VowTools} vowTools - * @param {boolean} [showOnConsole] */ -const testBadReplay = async (t, zone, vowTools, showOnConsole = false) => { - if (showOnConsole) { - t.log('badReplay started'); - } +const testBadReplay = async (t, zone, vowTools) => { + t.log('badReplay started'); const { asyncFlow, adminAsyncFlow } = prepareAsyncFlowTools(zone, { vowTools, }); @@ -165,9 +152,7 @@ const testBadReplay = async (t, zone, vowTools, showOnConsole = false) => { const { guestMethod } = { async guestMethod(gOrch7, gP) { t.is(this, 'context'); - if (showOnConsole) { - t.log(' badReplay about to await gP'); - } + t.log(' badReplay about to await gP'); resolveStep(true); await gP; const g2 = gOrch7.vow(); @@ -177,9 +162,7 @@ const testBadReplay = async (t, zone, vowTools, showOnConsole = false) => { t.is(prod, undefined); t.is(gOrch7.scale(9n), undefined); - if (showOnConsole) { - t.log(' badReplay about to await g2'); - } + t.log(' badReplay about to await g2'); // because of the replay failure, g2 should not settle in this incarnatuon await g2; t.fail('badReplay must not reach here'); @@ -217,10 +200,8 @@ const testBadReplay = async (t, zone, vowTools, showOnConsole = false) => { makeCopyMap([[flow, replayProblem]]), ); - if (showOnConsole) { - t.log(' badReplay failure', flow.getOptFatalProblem().message); - t.log('badReplay done', await promiseStep); - } + t.log(' badReplay failures', flow.getOptFatalProblem()); + t.log('badReplay done', await promiseStep); return promiseStep; }; @@ -228,12 +209,9 @@ const testBadReplay = async (t, zone, vowTools, showOnConsole = false) => { * @param {any} t * @param {import('@agoric/base-zone').Zone} zone * @param {import('@agoric/vow').VowTools} vowTools - * @param {boolean} [showOnConsole] */ -const testGoodReplay = async (t, zone, vowTools, showOnConsole = false) => { - if (showOnConsole) { - t.log('goodReplay started'); - } +const testGoodReplay = async (t, zone, vowTools) => { + t.log('goodReplay started'); const { asyncFlow, adminAsyncFlow } = prepareAsyncFlowTools(zone, { vowTools, }); @@ -248,9 +226,7 @@ const testGoodReplay = async (t, zone, vowTools, showOnConsole = false) => { const { guestMethod } = { async guestMethod(gOrch7, gP) { t.is(this, 'context'); - if (showOnConsole) { - t.log(' goodReplay about to await gP'); - } + t.log(' goodReplay about to await gP'); await gP; const g2 = gOrch7.vow(); const prod = gOrch7.scale(3); @@ -265,14 +241,10 @@ const testGoodReplay = async (t, zone, vowTools, showOnConsole = false) => { t.is(gErr.name, 'TypeError'); resolveStep(true); - if (showOnConsole) { - t.log(' goodReplay about to await g2'); - } + t.log(' goodReplay about to await g2'); // awaiting a promise that won't be resolved until this incarnation await g2; - if (showOnConsole) { - t.log(' goodReplay woke up!'); - } + t.log(' goodReplay woke up!'); }, }; @@ -319,21 +291,16 @@ const testGoodReplay = async (t, zone, vowTools, showOnConsole = false) => { t.is(await when(outcomeV), undefined); t.deepEqual(flow.dump(), []); - if (showOnConsole) { - t.log('goodReplay done', await promiseStep); - } + t.log('goodReplay done', await promiseStep); }; /** * @param {any} t * @param {import('@agoric/base-zone').Zone} zone * @param {import('@agoric/vow').VowTools} vowTools - * @param {boolean} [showOnConsole] */ -const testAfterPlay = async (t, zone, vowTools, showOnConsole = false) => { - if (showOnConsole) { - t.log('testAfterPlay started'); - } +const testAfterPlay = async (t, zone, vowTools) => { + t.log('testAfterPlay started'); const { asyncFlow, adminAsyncFlow } = prepareAsyncFlowTools(zone, { vowTools, }); @@ -360,15 +327,13 @@ const testAfterPlay = async (t, zone, vowTools, showOnConsole = false) => { t.deepEqual(flow.dump(), []); - if (showOnConsole) { - t.log('testAfterDoneReplay done'); - } + t.log('testAfterDoneReplay done'); }; await test.serial('test heap async-flow', async t => { const zone = makeHeapZone('heapRoot'); const vowTools = prepareVowTools(zone); - return testFirstPlay(t, zone, vowTools, asyncFlowVerbose()); + return testFirstPlay(t, zone, vowTools); }); await test.serial('test virtual async-flow', async t => { @@ -398,7 +363,7 @@ await test.serial('test durable async-flow', async t => { nextLife(); const zone3 = makeDurableZone(getBaggage(), 'durableRoot'); const vowTools3 = prepareWatchableVowTools(zone3); - await testGoodReplay(t, zone3, vowTools3, asyncFlowVerbose()); + await testGoodReplay(t, zone3, vowTools3); await eventLoopIteration();