diff --git a/packages/SwingSet/test/vo-test-harness/dvo-test-harness.test.js b/packages/SwingSet/test/vo-test-harness/dvo-test-harness.test.js index 00c04aa92d5..d141cd1cae4 100644 --- a/packages/SwingSet/test/vo-test-harness/dvo-test-harness.test.js +++ b/packages/SwingSet/test/vo-test-harness/dvo-test-harness.test.js @@ -1,3 +1,4 @@ +import { makeSpy } from '@agoric/swingset-liveslots/tools/vo-test-harness.js'; import { test, runDVOTest } from '../../tools/dvo-test-harness.js'; function bfile(name) { @@ -6,17 +7,27 @@ function bfile(name) { async function dvoTestTest(t, mode) { function testLogCheck(_t, phase, log) { - t.deepEqual(log, ['start test', phase, 'test thing', { mode }, 'end test']); + t.deepEqual(log, [ + 'start test', + phase, + `fail during "${phase}"`, + { mode }, + 'end test', + ]); } await runDVOTest(t, testLogCheck, bfile('vat-dvo-test-test.js'), { mode }); } -test.failing('fail during "before" phase', async t => { +test('fail during "before" phase', async t => { + const tSpy = makeSpy(t); await dvoTestTest(t, 'before'); + t.is(tSpy.failureMessage, 'fail during "before"'); }); -test.failing('fail during "after" phase', async t => { +test('fail during "after" phase', async t => { + const tSpy = makeSpy(t); await dvoTestTest(t, 'after'); + t.is(tSpy.failureMessage, 'fail during "after"'); }); test('succeed', async t => { diff --git a/packages/swingset-liveslots/test/vo-test-harness.test.js b/packages/swingset-liveslots/test/vo-test-harness.test.js index d8341c7405c..a87e7936722 100644 --- a/packages/swingset-liveslots/test/vo-test-harness.test.js +++ b/packages/swingset-liveslots/test/vo-test-harness.test.js @@ -1,5 +1,5 @@ import test from 'ava'; -import { runVOTest } from '../tools/vo-test-harness.js'; +import { makeSpy, runVOTest } from '../tools/vo-test-harness.js'; async function voTestTest(t, mode) { let makeThing; @@ -36,8 +36,6 @@ async function voTestTest(t, mode) { await runVOTest(t, prepare, makeTestThing, testTestThing); } -// Note: these first two are not marked "test.failing" because -// something is wrong and we need to fix it. Rather, they are // confirming that the voTestTest harness would catch problems during // downstream tests that use the harness, if those problems arose in // the "before" or "after" phases, and reported by the downstream test @@ -47,20 +45,26 @@ async function voTestTest(t, mode) { // fails, otherwise the harness is not doing its job, and is hiding // real test failures in some downstream client package. -test.failing('fail during "before" phase', async t => { - await voTestTest(t, 'before'); +test('fail during "before" phase', async t => { + const tSpy = makeSpy(t); + await voTestTest(tSpy, 'before'); + t.is(tSpy.failureMessage, 'deliberate failure in before phase'); }); -test.failing('fail during "after" phase', async t => { - await voTestTest(t, 'after'); +test('fail during "after" phase', async t => { + const tSpy = makeSpy(t); + await voTestTest(tSpy, 'after'); + t.is(tSpy.failureMessage, 'deliberate failure in after phase'); }); // Similarly, this test makes sure that our harness can detect when // the downstream test misbehaves and holds on to the object they were // supposed to drop. -test.failing('fail due to held object', async t => { - await voTestTest(t, 'hold'); +test('fail due to held object', async t => { + const tSpy = makeSpy(t); + await voTestTest(tSpy, 'hold'); + t.is(tSpy.falsyMessage, 'somebody continues to hold test object'); }); test.serial('succeed', async t => {