Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up liveslots tests #10739

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/swingset-liveslots/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"lint:eslint": "eslint ."
},
"dependencies": {
"@endo/errors": "^1.2.8",
"@agoric/internal": "^0.3.2",
"@agoric/store": "^0.9.2",
"@endo/env-options": "^1.1.8",
"@endo/errors": "^1.2.8",
"@endo/eventual-send": "^1.2.8",
"@endo/exo": "^1.5.7",
"@endo/far": "^1.1.9",
Expand All @@ -32,8 +32,8 @@
"@endo/promise-kit": "^1.1.8"
},
"devDependencies": {
"ava": "^5.3.0",
"@agoric/kmarshal": "^0.1.0"
"@agoric/kmarshal": "^0.1.0",
"ava": "^6.2.0"
},
"files": [
"src/**/*.js",
Expand All @@ -59,8 +59,7 @@
"require": [
"@endo/init/debug.js"
],
"timeout": "20m",
"workerThreads": false
"timeout": "20m"
},
"publishConfig": {
"access": "public"
Expand Down
37 changes: 29 additions & 8 deletions packages/swingset-liveslots/test/vo-test-harness.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -47,20 +45,43 @@ 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');
const makeSpy = t => {
const tSpy = {
...t,
fail: msg => {
tSpy.failureMessage = msg;
},
// In Ava 6, assertions throw?
falsy: (check, msg) => {
if (!check) return;
tSpy.falsyMessage = msg;
},
failureMessage: '',
falsyMessage: '',
};
return tSpy;
};

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 => {
Expand Down
Loading
Loading