From 3914c02ecffc02fc8a97f1c7cc480fbb9ea8c256 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 1 Apr 2022 09:19:29 -0700 Subject: [PATCH] chore: comply with ava/recommended eslint --- packages/SwingSet/test/message-patterns.js | 3 +-- packages/SwingSet/test/test-bundle-handler.js | 6 ++--- .../vat-admin/terminate/test-terminate.js | 1 + .../SwingSet/test/vat-admin/test-replay.js | 1 + .../test/test-export-storage.js | 4 +-- .../test/test-provision-smartwallet.js | 8 +----- .../committeeBinary/test-committee.js | 2 ++ .../test/unitTests/test-importsA.js | 9 ------- .../test/test-gov-collateral.js | 8 +++--- packages/internal/test/test-callback.js | 2 +- .../internal/test/test-priority-senders.js | 2 +- packages/notifier/test/test-publish-kit.js | 6 +++-- packages/solo/src/start.js | 1 + packages/solo/test/test-home.js | 2 +- .../test/test-durabilityChecks.js | 4 +-- .../test/test-facetiousness.js | 2 +- .../test/test-handled-promises.js | 8 +++--- .../test/test-initial-vrefs.js | 2 +- .../swingset-liveslots/test/test-liveslots.js | 23 ++++++++-------- packages/swingset-liveslots/test/util.js | 2 +- .../virtual-objects/test-cease-recognition.js | 2 +- .../test/virtual-objects/test-cross-facet.js | 2 +- .../test/virtual-objects/test-empty-data.js | 2 +- .../test/virtual-objects/test-facets.js | 2 +- .../virtual-objects/test-reachable-vrefs.js | 2 +- .../test/virtual-objects/test-rep-tostring.js | 4 +-- .../test-weakcollections-vref-handling.js | 2 +- packages/time/test/test-timeMath.js | 2 +- packages/vats/test/test-dump.js | 17 +++++------- packages/vats/test/test-repl.js | 20 +++++++------- .../vats/test/upgrading/test-upgrade-vats.js | 2 +- packages/xsnap-lockdown/test/test-inspect.js | 3 ++- packages/xsnap/test/test-boot-lockdown.js | 8 +++--- packages/xsnap/test/test-gc.js | 2 +- packages/xsnap/test/test-replay.js | 2 +- packages/xsnap/test/test-xs-limits.js | 2 +- packages/xsnap/test/test-xs-perf.js | 7 ++--- packages/xsnap/test/test-xsnap.js | 27 ++++++++++--------- .../zoe/test/swingsetTests/zoe/test-zoe.js | 2 +- 39 files changed, 98 insertions(+), 108 deletions(-) diff --git a/packages/SwingSet/test/message-patterns.js b/packages/SwingSet/test/message-patterns.js index 26aed4cec3a..fc10fe888d1 100644 --- a/packages/SwingSet/test/message-patterns.js +++ b/packages/SwingSet/test/message-patterns.js @@ -1,5 +1,4 @@ -/* eslint no-lone-blocks: "off" */ -/* eslint dot-notation: "off" */ +/* eslint-disable no-lone-blocks, dot-notation */ // I turned off dot-notation so eslint won't rewrite the grep-preserving // test.stuff patterns. diff --git a/packages/SwingSet/test/test-bundle-handler.js b/packages/SwingSet/test/test-bundle-handler.js index afb69a1e064..5dc879e8f75 100644 --- a/packages/SwingSet/test/test-bundle-handler.js +++ b/packages/SwingSet/test/test-bundle-handler.js @@ -56,8 +56,8 @@ test('bundle handler', async t => { t.is(store.size, 2); t.deepEqual(ids, ['b0-lockdown.sha', 'b0-supervisor.sha']); // contents were fetched from bundleData - t.deepEqual(await handler.getBundle('b0-lockdown.sha'), 'lockdown'); - t.deepEqual(await handler.getBundle('b0-supervisor.sha'), 'supervisor'); + t.is(await handler.getBundle('b0-lockdown.sha'), 'lockdown'); + t.is(await handler.getBundle('b0-supervisor.sha'), 'supervisor'); // subsequent queries should check hashes/ids but not re-read bundles const ids2 = await handler.getCurrentBundleIDs(); @@ -67,7 +67,7 @@ test('bundle handler', async t => { // getBundle is served from bundleStore, not elsewhere store.set('b0-lockdown.sha', 'other'); - t.deepEqual(await handler.getBundle('b0-lockdown.sha'), 'other'); + t.is(await handler.getBundle('b0-lockdown.sha'), 'other'); }); test('bundle data', async t => { diff --git a/packages/SwingSet/test/vat-admin/terminate/test-terminate.js b/packages/SwingSet/test/vat-admin/terminate/test-terminate.js index c4e194a0c97..9b63e39d139 100644 --- a/packages/SwingSet/test/vat-admin/terminate/test-terminate.js +++ b/packages/SwingSet/test/vat-admin/terminate/test-terminate.js @@ -1,4 +1,5 @@ // @ts-nocheck +/* eslint-disable no-lone-blocks */ // eslint-disable-next-line import/order import { test } from '../../../tools/prepare-test-env-ava.js'; // eslint-disable-next-line import/order diff --git a/packages/SwingSet/test/vat-admin/test-replay.js b/packages/SwingSet/test/vat-admin/test-replay.js index 6011f7a9363..6e57a4868c5 100644 --- a/packages/SwingSet/test/vat-admin/test-replay.js +++ b/packages/SwingSet/test/vat-admin/test-replay.js @@ -1,4 +1,5 @@ // @ts-nocheck +/* eslint-disable no-lone-blocks */ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; // eslint-disable-next-line import/order diff --git a/packages/cosmic-swingset/test/test-export-storage.js b/packages/cosmic-swingset/test/test-export-storage.js index 65e0b8dba33..07d6b90f3a6 100644 --- a/packages/cosmic-swingset/test/test-export-storage.js +++ b/packages/cosmic-swingset/test/test-export-storage.js @@ -58,7 +58,7 @@ const makeBatchChainStorage = published => { return { batchChainStorage, deleted }; }; -test('exportStorage example', async t => { +test('exportStorage example', t => { const exportStorageSubtrees = ['published.c.o']; const expected = [ ['published.c.o', 'top'], @@ -82,7 +82,7 @@ test('exportStorage example', async t => { t.deepEqual(actual, expected); }); -test('exportStorage clears crufty ToyUSD PSM', async t => { +test('exportStorage clears crufty ToyUSD PSM', t => { const config = { clearStorageSubtrees: ['published'], exportStorageSubtrees: [ diff --git a/packages/cosmic-swingset/test/test-provision-smartwallet.js b/packages/cosmic-swingset/test/test-provision-smartwallet.js index 01df5c206cf..9a3e4cce6eb 100644 --- a/packages/cosmic-swingset/test/test-provision-smartwallet.js +++ b/packages/cosmic-swingset/test/test-provision-smartwallet.js @@ -59,13 +59,7 @@ test.before(async t => { t.context = { scenario2, walletTool, pspawnAgd, bootstrapAddr, soloAddr }; }); -// SKIP: struggling with timing issues resulting in one of... -// Error: cannot grab 250000uist coins: 0uist is smaller than 250000uist: insufficient funds -// error: code = NotFound desc = account agoric1mhu... not found -// Sometimes I can get this test to work alone, but not -// if run with the test above. -// TODO: https://github.com/Agoric/agoric-sdk/issues/6766 -test.skip('integration test: smart wallet provision', async t => { +test('integration test: smart wallet provision', async t => { const { scenario2, walletTool, soloAddr } = t.context; const enoughBlocksToProvision = 7; diff --git a/packages/governance/test/swingsetTests/committeeBinary/test-committee.js b/packages/governance/test/swingsetTests/committeeBinary/test-committee.js index 7887a58d159..2b8644641dc 100644 --- a/packages/governance/test/swingsetTests/committeeBinary/test-committee.js +++ b/packages/governance/test/swingsetTests/committeeBinary/test-committee.js @@ -1,3 +1,5 @@ +/* eslint-disable ava/assertion-arguments -- the standard diff is unreadable */ +// eslint-disable-next-line import/no-extraneous-dependencies import '@endo/init/debug.js'; import test from 'ava'; import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; diff --git a/packages/import-manager/test/unitTests/test-importsA.js b/packages/import-manager/test/unitTests/test-importsA.js index a88af3c8cc0..1c3e1f18ba2 100644 --- a/packages/import-manager/test/unitTests/test-importsA.js +++ b/packages/import-manager/test/unitTests/test-importsA.js @@ -27,12 +27,3 @@ test('import listIsEmpty (true)', t => { const op = 'listIsEmpty'; t.truthy(importer[op]([])); }); - -// TODO: This test throws because `lookupImport` does not exist. This -// test needs to be fixed. -test.skip('import not found', t => { - const importer = makeGoodImportManager(); - t.throws(() => importer.lookupImport('emptyPixel'), { - message: /There is no entry for "c"./, - }); -}); diff --git a/packages/inter-protocol/test/test-gov-collateral.js b/packages/inter-protocol/test/test-gov-collateral.js index cf71a904160..6bdf65da0b6 100644 --- a/packages/inter-protocol/test/test-gov-collateral.js +++ b/packages/inter-protocol/test/test-gov-collateral.js @@ -433,7 +433,7 @@ const makeScenario = async (t, { env = process.env } = {}) => { }; }; -test.skip('Benefactor can add to reserve', async t => { +test.failing('Benefactor can add to reserve', async t => { const s = await makeScenario(t); await s.startDevNet(); await s.provisionMembers(); @@ -448,7 +448,7 @@ test.skip('Benefactor can add to reserve', async t => { t.deepEqual(result, 'added Collateral to the Reserve'); }); -test.skip('voters get invitations', async t => { +test.failing('voters get invitations', async t => { const s = await makeScenario(t); await s.startDevNet(); const purses = await s.provisionMembers(); @@ -480,7 +480,7 @@ test.skip('voters get invitations', async t => { ); }); -test.skip('assets are in Vaults', async t => { +test.failing('assets are in Vaults', async t => { const s = await makeScenario(t); await s.startDevNet(); await s.provisionMembers(); @@ -516,7 +516,7 @@ test.skip('assets are in Vaults', async t => { }); }); -test.skip('Committee can raise debt limit', async t => { +test.failing('Committee can raise debt limit', async t => { const s = await makeScenario(t); await s.startDevNet(); const invitationPurses = await s.provisionMembers(); diff --git a/packages/internal/test/test-callback.js b/packages/internal/test/test-callback.js index 6b020632608..863ee1aa07e 100644 --- a/packages/internal/test/test-callback.js +++ b/packages/internal/test/test-callback.js @@ -188,7 +188,7 @@ test('far function callbacks', async t => { t.is(await p2r, '19go'); }); -test('bad callbacks', async t => { +test('bad callbacks', t => { t.throws( // @ts-expect-error deliberate: number is not assignable to function () => cb.makeFunctionCallback(42), diff --git a/packages/internal/test/test-priority-senders.js b/packages/internal/test/test-priority-senders.js index c3990235bf8..dfdbab71e06 100644 --- a/packages/internal/test/test-priority-senders.js +++ b/packages/internal/test/test-priority-senders.js @@ -71,7 +71,7 @@ test('normalization', async t => { await manager.add('this,has,commas,', 'addr'); await writesSettled(); - t.deepEqual( + t.is( storage.data.get(`${HIGH_PRIORITY_SENDERS}.addr`), 'something_with_spaces,something_with_spaces_and___,this_has_commas_', ); diff --git a/packages/notifier/test/test-publish-kit.js b/packages/notifier/test/test-publish-kit.js index 709a4c1ded7..49366a6d15c 100644 --- a/packages/notifier/test/test-publish-kit.js +++ b/packages/notifier/test/test-publish-kit.js @@ -395,6 +395,7 @@ test('durable publish kit upgrade trauma (full-vat integration)', async t => { const eachIterator2 = await run('messageVatObject', [ { presence: eachIterable, methodName: Symbol.asyncIterator }, ]); + // eslint-disable-next-line ava/prefer-async-await const assertDisconnection = (p, label) => { const expected = { incarnationNumber: 0, @@ -402,7 +403,8 @@ test('durable publish kit upgrade trauma (full-vat integration)', async t => { upgradeMessage: 'vat upgraded', }; return p.then( - (...args) => t.deepEqual(args, undefined, `${label} must be rejected`), + // @ts-expect-error Argument of type 'undefined' is not assignable to parameter of type 'any[]'. + (...args) => t.is(args, undefined, `${label} must be rejected`), failure => t.deepEqual(failure, expected, `${label} must indicate disconnection`), ); @@ -458,7 +460,7 @@ test('durable publish kit upgrade trauma (full-vat integration)', async t => { // TODO: Find a way to test virtual object rehydration // without the overhead of vats. // https://github.com/Agoric/agoric-sdk/pull/6502#discussion_r1008492055 -test.skip('durable publish kit upgrade trauma', async t => { +test.failing('durable publish kit upgrade trauma', async t => { const baggage = makeBaggage(); const makeDurablePublishKit = prepareDurablePublishKit( baggage, diff --git a/packages/solo/src/start.js b/packages/solo/src/start.js index 6b62e22bfe9..1aaae537116 100644 --- a/packages/solo/src/start.js +++ b/packages/solo/src/start.js @@ -1,4 +1,5 @@ // @ts-check +/* eslint-disable no-lone-blocks */ /* global process setTimeout */ import fs from 'fs'; import url from 'url'; diff --git a/packages/solo/test/test-home.js b/packages/solo/test/test-home.js index 7f09bd6cc75..246fd5caa58 100644 --- a/packages/solo/test/test-home.js +++ b/packages/solo/test/test-home.js @@ -155,7 +155,7 @@ test.serial('home.localTimerService makeNotifier', async t => { const notifier = E(localTimerService).makeNotifier(1n, 1n); const update1 = await E(notifier).getUpdateSince(); const firstUpdate = update1.updateCount; - t.truthy(firstUpdate > 0); + t.true(firstUpdate > 0); const update2 = await E(notifier).getUpdateSince(update1.updateCount); t.truthy(BigInt(update2.updateCount) > BigInt(firstUpdate)); diff --git a/packages/swingset-liveslots/test/test-durabilityChecks.js b/packages/swingset-liveslots/test/test-durabilityChecks.js index 29e60067791..3004d99dcb7 100644 --- a/packages/swingset-liveslots/test/test-durabilityChecks.js +++ b/packages/swingset-liveslots/test/test-durabilityChecks.js @@ -269,5 +269,5 @@ async function runDurabilityCheckTest(t, relaxDurabilityRules) { } } -test('durability checks (strict)', t => runDurabilityCheckTest(t, false)); -test('durability checks (relaxed)', t => runDurabilityCheckTest(t, true)); +test('durability checks (strict)', runDurabilityCheckTest, false); +test('durability checks (relaxed)', runDurabilityCheckTest, true); diff --git a/packages/swingset-liveslots/test/test-facetiousness.js b/packages/swingset-liveslots/test/test-facetiousness.js index e418397ef0a..d0613f395fa 100644 --- a/packages/swingset-liveslots/test/test-facetiousness.js +++ b/packages/swingset-liveslots/test/test-facetiousness.js @@ -126,7 +126,7 @@ test('checkAndUpdateFacetiousness', t => { t.deepEqual(cauf({}, barfoo), barfoo); // a single Kind can only be redefined as another single - t.deepEqual(cauf(desc(), undefined), undefined); + t.is(cauf(desc(), undefined), undefined); t.throws(() => cauf(desc(), foo), { message: 'defineDurableKindMulti called for unfaceted KindHandle "tag"', }); diff --git a/packages/swingset-liveslots/test/test-handled-promises.js b/packages/swingset-liveslots/test/test-handled-promises.js index ebb1af63ad2..d264c8d3334 100644 --- a/packages/swingset-liveslots/test/test-handled-promises.js +++ b/packages/swingset-liveslots/test/test-handled-promises.js @@ -232,12 +232,12 @@ test('past-incarnation watched promises', async t => { t.deepEqual(getDispatchLogs(), [ fulfillmentMessage(`p-${nextPImport()}`, 'created local promise: rejected'), ]); - t.deepEqual( + t.is( lastPImport - firstPImport + 1, 4, 'imported 4 promises (1 per dispatch)', ); - t.deepEqual(lastPExport - firstPExport + 1, 1, 'exported 1 promise: first'); + t.is(lastPExport - firstPExport + 1, 1, 'exported 1 promise: first'); await dispatchMessage('watchLocalPromise', 'orphaned'); t.deepEqual(getDispatchLogs(), [ @@ -259,12 +259,12 @@ test('past-incarnation watched promises', async t => { fulfillmentMessage(`p-${nextPImport()}`, 'watched local promise: rejected'), rejectionMessage(`p+${lastPExport}`, S), ]); - t.deepEqual( + t.is( lastPImport - firstPImport + 1, 7, 'imported 7 promises (1 per dispatch)', ); - t.deepEqual( + t.is( lastPExport - firstPExport + 1, 4, 'exported 4 promises: first, orphaned, fulfilled, rejected', diff --git a/packages/swingset-liveslots/test/test-initial-vrefs.js b/packages/swingset-liveslots/test/test-initial-vrefs.js index 48ba28a7fd5..1de3224501b 100644 --- a/packages/swingset-liveslots/test/test-initial-vrefs.js +++ b/packages/swingset-liveslots/test/test-initial-vrefs.js @@ -148,5 +148,5 @@ test('vrefs', async t => { const expectedStore1Vref = `o+v${initialKindIDs.scalarMapStore}/5`; const store1Vref = (await run('getStore1')).slots[0]; t.is(store1Vref, expectedStore1Vref); - t.deepEqual(kunser(JSON.parse(fakestore.get(`vc.5.s${'key'}`))), 'value'); + t.is(kunser(JSON.parse(fakestore.get(`vc.5.s${'key'}`))), 'value'); }); diff --git a/packages/swingset-liveslots/test/test-liveslots.js b/packages/swingset-liveslots/test/test-liveslots.js index d2350a5c516..eaff34b36d6 100644 --- a/packages/swingset-liveslots/test/test-liveslots.js +++ b/packages/swingset-liveslots/test/test-liveslots.js @@ -46,14 +46,14 @@ test('calls', async t => { // root!one() // sendOnly await dispatch(makeMessage(rootA, 'one', ['args'])); - t.deepEqual(log.shift(), 'one'); + t.is(log.shift(), 'one'); // pr = makePromise() // root!two(pr.promise) // pr.resolve('result') await dispatch(makeMessage(rootA, 'two', [kslot('p-1')])); t.deepEqual(log.shift(), { type: 'subscribe', target: 'p-1' }); - t.deepEqual(log.shift(), 'two true'); + t.is(log.shift(), 'two true'); await dispatch(makeResolve('p-1', kser('result'))); t.deepEqual(log.shift(), ['res', 'result']); @@ -64,7 +64,7 @@ test('calls', async t => { await dispatch(makeMessage(rootA, 'two', [kslot('p-2')])); t.deepEqual(log.shift(), { type: 'subscribe', target: 'p-2' }); - t.deepEqual(log.shift(), 'two true'); + t.is(log.shift(), 'two true'); await dispatch(makeReject('p-2', kser('rejection'))); t.deepEqual(log.shift(), ['rej', 'rejection']); @@ -100,7 +100,7 @@ test('liveslots pipelines to syscall.send', async t => { // for x!pipe1(), a second pipelined to the result promise of it, and a // third pipelined to the result of the second. - t.deepEqual(log.shift(), 'sent p1p2p3'); + t.is(log.shift(), 'sent p1p2p3'); t.deepEqual(log.shift(), { type: 'send', targetSlot: x, @@ -657,8 +657,7 @@ test('capdata size limit on syscalls', async t => { }; const send = op => dispatch(makeMessage(rootA, op, [kslot(target)], rp)); - const expectFail = () => - t.deepEqual(log.shift(), 'fail: syscall capdata too large'); + const expectFail = () => t.is(log.shift(), 'fail: syscall capdata too large'); const expectVoidReturn = () => t.deepEqual(log.shift(), { type: 'resolve', @@ -907,7 +906,7 @@ test('disable disavow', async t => { // root~.one() // sendOnly await dispatch(makeMessage(rootA, 'one', [])); - t.deepEqual(log.shift(), false); + t.is(log.shift(), false); t.deepEqual(log, []); }); @@ -968,7 +967,7 @@ test('disavow', async t => { // root~.one(import1) // sendOnly await dispatch(makeMessage(rootA, 'one', [kslot(import1)])); t.deepEqual(log.shift(), { type: 'dropImports', slots: [import1] }); - t.deepEqual(log.shift(), 'disavowed pres1'); + t.is(log.shift(), 'disavowed pres1'); function loggedError(re) { const l = log.shift(); @@ -976,11 +975,11 @@ test('disavow', async t => { t.truthy(re.test(l.message)); } loggedError(/attempt to disavow unknown/); - t.deepEqual(log.shift(), 'tried duplicate disavow'); + t.is(log.shift(), 'tried duplicate disavow'); loggedError(/attempt to disavow unknown/); - t.deepEqual(log.shift(), 'tried to disavow Promise'); + t.is(log.shift(), 'tried to disavow Promise'); loggedError(/attempt to disavow an export/); - t.deepEqual(log.shift(), 'tried to disavow export'); + t.is(log.shift(), 'tried to disavow export'); const msg = log.shift(); t.like(msg, { type: 'exit', @@ -988,7 +987,7 @@ test('disavow', async t => { }); expectError(t, msg.info, /this Presence has been disavowed/); t.deepEqual(log.shift(), Error('this Presence has been disavowed')); - t.deepEqual(log.shift(), 'tried to send to disavowed'); + t.is(log.shift(), 'tried to send to disavowed'); t.deepEqual(log, []); }); diff --git a/packages/swingset-liveslots/test/util.js b/packages/swingset-liveslots/test/util.js index 96816290901..22af120c7ec 100644 --- a/packages/swingset-liveslots/test/util.js +++ b/packages/swingset-liveslots/test/util.js @@ -48,7 +48,7 @@ export function buildDispatch(onDispatchCallback) { /** * @param {unknown} target - * @param {string} method + * @param {string | symbol} method * @param {any[]} args * @param {unknown} result */ diff --git a/packages/swingset-liveslots/test/virtual-objects/test-cease-recognition.js b/packages/swingset-liveslots/test/virtual-objects/test-cease-recognition.js index 2424ea23d30..31646fc913e 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-cease-recognition.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-cease-recognition.js @@ -39,7 +39,7 @@ function weakKeyCheck(t, log, vref) { t.true(result === undefined || !result.startsWith(prefix), `ew:${result}`); } -test('only enumerate virtual objects', async t => { +test('only enumerate virtual objects', t => { const { log, vrm } = makeVRM(); // retiring a plain Remotable does a is-it-a-weak-key chck diff --git a/packages/swingset-liveslots/test/virtual-objects/test-cross-facet.js b/packages/swingset-liveslots/test/virtual-objects/test-cross-facet.js index e77f3030039..9a087ae92b8 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-cross-facet.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-cross-facet.js @@ -15,7 +15,7 @@ function attack2(mut1, immut2) { Reflect.apply(mutableProto.set, immut2, [6]); } -test('forbid cross-facet prototype attack', async t => { +test('forbid cross-facet prototype attack', t => { const vom = makeFakeVirtualObjectManager(); const init = () => ({ value: 0 }); const behavior = { diff --git a/packages/swingset-liveslots/test/virtual-objects/test-empty-data.js b/packages/swingset-liveslots/test/virtual-objects/test-empty-data.js index b9f47259e82..1998b90267f 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-empty-data.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-empty-data.js @@ -3,7 +3,7 @@ import '@endo/init/debug.js'; import { makeFakeVirtualObjectManager } from '../../tools/fakeVirtualSupport.js'; -test('non-object initial data message', async t => { +test('non-object initial data message', t => { const vom = makeFakeVirtualObjectManager(); const goodInit = () => ({ value: 0 }); // 'badInit' is () => { value: 0 } diff --git a/packages/swingset-liveslots/test/virtual-objects/test-facets.js b/packages/swingset-liveslots/test/virtual-objects/test-facets.js index f604a1dd82c..fdc43367a76 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-facets.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-facets.js @@ -3,7 +3,7 @@ import '@endo/init/debug.js'; import { makeFakeVirtualObjectManager } from '../../tools/fakeVirtualSupport.js'; -test('facets', async t => { +test('facets', t => { const vom = makeFakeVirtualObjectManager(); const init = () => ({ value: 0 }); const behavior = { diff --git a/packages/swingset-liveslots/test/virtual-objects/test-reachable-vrefs.js b/packages/swingset-liveslots/test/virtual-objects/test-reachable-vrefs.js index 4c84d94d968..76a7f5de736 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-reachable-vrefs.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-reachable-vrefs.js @@ -8,7 +8,7 @@ import { initEmpty } from '@agoric/store'; import { makeVatSlot } from '../../src/parseVatSlots.js'; import { makeFakeVirtualStuff } from '../../tools/fakeVirtualSupport.js'; -test('VOM tracks reachable vrefs', async t => { +test('VOM tracks reachable vrefs', t => { const { vom, vrm, cm } = makeFakeVirtualStuff(); const { defineKind } = vom; const { makeScalarBigWeakMapStore } = cm; diff --git a/packages/swingset-liveslots/test/virtual-objects/test-rep-tostring.js b/packages/swingset-liveslots/test/virtual-objects/test-rep-tostring.js index 4803f76b341..8c126c6706e 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-rep-tostring.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-rep-tostring.js @@ -16,7 +16,7 @@ const init = () => ({}); const behavior = {}; const facets = { foo: {}, bar: {} }; -test('representatives with label-instances', async t => { +test('representatives with label-instances', t => { const { fakeStuff, vom } = makeFakeVirtualStuff(); const { getSlotForVal } = fakeStuff; const makeThing = vom.defineKind('thing', init, behavior); @@ -33,7 +33,7 @@ test('representatives with label-instances', async t => { t.is(`${q(thing2)}`, `"[Alleged: thing#${thing2vref}]"`); }); -test('facets with label-instances', async t => { +test('facets with label-instances', t => { const { fakeStuff, vom } = makeFakeVirtualStuff(); const { getSlotForVal } = fakeStuff; const makeThings = vom.defineKindMulti('thing', init, facets); diff --git a/packages/swingset-liveslots/test/virtual-objects/test-weakcollections-vref-handling.js b/packages/swingset-liveslots/test/virtual-objects/test-weakcollections-vref-handling.js index a34c6987c3f..170a43802c3 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-weakcollections-vref-handling.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-weakcollections-vref-handling.js @@ -3,7 +3,7 @@ import '@endo/init/debug.js'; import { makeFakeVirtualObjectManager } from '../../tools/fakeVirtualSupport.js'; -test('weakMap vref handling', async t => { +test('weakMap vref handling', t => { const log = []; const { VirtualObjectAwareWeakMap, diff --git a/packages/time/test/test-timeMath.js b/packages/time/test/test-timeMath.js index dd16ef77002..2befd6041a9 100644 --- a/packages/time/test/test-timeMath.js +++ b/packages/time/test/test-timeMath.js @@ -56,7 +56,7 @@ test('timeMath one label', t => { }); test('timeMath no labels', t => { - t.deepEqual(TimeMath.addAbsRel(100n, 3n), 103n); + t.is(TimeMath.addAbsRel(100n, 3n), 103n); }); // TODO: < should fail diff --git a/packages/vats/test/test-dump.js b/packages/vats/test/test-dump.js index ce6a909936b..31ec4c0c0e2 100644 --- a/packages/vats/test/test-dump.js +++ b/packages/vats/test/test-dump.js @@ -1,11 +1,10 @@ -// @ts-check -import '@endo/init/debug.js'; +import '@endo/init'; import test from 'ava'; import { dump } from '../src/repl.js'; -// Taken from https://github.com/endojs/endo/blob/43b796232634b54c9e7de1c0a2349d22c29fc384/packages/ses/test/error/test-assert-log.js#L414 -test('dump: the @erights challenge', async t => { +// Taken from https://github.com/endojs/endo/tree/main/packages/ses/test/error/test-assert-log.js#L414 +test('dump: the @erights challenge', t => { const superTagged = { [Symbol.toStringTag]: 'Tagged' }; const subTagged = { __proto__: superTagged }; const subTaggedNonEmpty = { __proto__: superTagged, foo: 'x' }; @@ -25,14 +24,13 @@ test('dump: the @erights challenge', async t => { }, 2 ** 54, { superTagged, subTagged, subTaggedNonEmpty }, - { __proto__: null }, ]; t.is( dump(challenges), - '[[Promise],[Function foo],"[hilbert]",undefined,"undefined",[URIError: wut?],[33n,Symbol(foo),Symbol(bar),Symbol(Symbol.asyncIterator)],{"NaN":NaN,"Infinity":Infinity,"neg":-Infinity},18014398509481984,{"superTagged":[Object Tagged]{[Symbol(Symbol.toStringTag)]:"Tagged"},"subTagged":[Object Tagged]{},"subTaggedNonEmpty":[Object Tagged]{"foo":"x"}},{}]', + '[[Promise],[Function foo],"[hilbert]",undefined,"undefined",[URIError: wut?],[33n,Symbol(foo),Symbol(bar),Symbol(Symbol.asyncIterator)],{"NaN":NaN,"Infinity":Infinity,"neg":-Infinity},18014398509481984,{"superTagged":{[Symbol(Symbol.toStringTag)]:"Tagged"},"subTagged":[Object Tagged]{},"subTaggedNonEmpty":[Object Tagged]{"foo":"x"}}]', ); t.is( - dump(challenges, 2), + dump(challenges, ' '), `\ [ [Promise], @@ -54,15 +52,14 @@ test('dump: the @erights challenge', async t => { }, 18014398509481984, { - "superTagged": [Object Tagged] { + "superTagged": { [Symbol(Symbol.toStringTag)]: "Tagged" }, "subTagged": [Object Tagged] {}, "subTaggedNonEmpty": [Object Tagged] { "foo": "x" } - }, - {} + } ]`, ); }); diff --git a/packages/vats/test/test-repl.js b/packages/vats/test/test-repl.js index c9f0553d250..8cece741517 100644 --- a/packages/vats/test/test-repl.js +++ b/packages/vats/test/test-repl.js @@ -25,7 +25,7 @@ test('repl: basic eval, eventual promise resolution', async t => { const { doEval, sentMessages, getHighestHistory } = make(); let m = sentMessages.shift(); - t.deepEqual(m.type, 'updateHistory'); + t.is(m.type, 'updateHistory'); t.is(sentMessages.length, 0); t.deepEqual(getHighestHistory(), { highestHistory: -1 }); @@ -62,13 +62,13 @@ test('repl: basic eval, eventual promise resolution', async t => { t.deepEqual(sentMessages, []); }); -test('repl: bigInts', async t => { +test('repl: bigInts', t => { const { doEval, sentMessages } = make(); let m = sentMessages.shift(); t.deepEqual(doEval(0, '3n'), {}); m = sentMessages.shift(); - t.deepEqual(m.type, 'updateHistory'); + t.is(m.type, 'updateHistory'); t.is(sentMessages.length, 1); t.is(m.histnum, 0); @@ -80,7 +80,7 @@ test('repl: bigInts', async t => { t.deepEqual(sentMessages, []); }); -test('repl: Symbols', async t => { +test('repl: Symbols', t => { const { doEval, sentMessages } = make(); let m = sentMessages.shift(); @@ -96,7 +96,7 @@ test('repl: Symbols', async t => { for (const [expr, display] of exprDisplays) { t.deepEqual(doEval(histnum, expr), {}); m = sentMessages.shift(); - t.deepEqual(m.type, 'updateHistory'); + t.is(m.type, 'updateHistory'); t.is(sentMessages.length, 1); t.is(m.histnum, histnum); @@ -110,7 +110,7 @@ test('repl: Symbols', async t => { } }); -test('repl: unjsonables', async t => { +test('repl: unjsonables', t => { const { doEval, sentMessages } = make(); let m = sentMessages.shift(); @@ -119,7 +119,7 @@ test('repl: unjsonables', async t => { for (const valStr of ['NaN', 'Infinity', '-Infinity', 'undefined']) { t.deepEqual(doEval(histnum, valStr), {}); m = sentMessages.shift(); - t.deepEqual(m.type, 'updateHistory'); + t.is(m.type, 'updateHistory'); t.is(sentMessages.length, 1); t.is(m.histnum, histnum); @@ -133,11 +133,11 @@ test('repl: unjsonables', async t => { } }); -test('repl: sloppyGlobals, home, endowments', async t => { +test('repl: sloppyGlobals, home, endowments', t => { const { doEval, sentMessages } = make(); let m = sentMessages.shift(); - t.deepEqual(m.type, 'updateHistory'); + t.is(m.type, 'updateHistory'); t.is(sentMessages.length, 0); t.deepEqual( @@ -170,7 +170,7 @@ test('repl: eventual send', async t => { const { doEval, sentMessages } = make(); let m = sentMessages.shift(); - t.deepEqual(m.type, 'updateHistory'); + t.is(m.type, 'updateHistory'); t.is(sentMessages.length, 0); t.deepEqual(doEval(0, 'target = harden({ foo(x) { return x+1; } })'), {}); diff --git a/packages/vats/test/upgrading/test-upgrade-vats.js b/packages/vats/test/upgrading/test-upgrade-vats.js index 39b8130bed3..fc211373c89 100644 --- a/packages/vats/test/upgrading/test-upgrade-vats.js +++ b/packages/vats/test/upgrading/test-upgrade-vats.js @@ -102,7 +102,7 @@ test('upgrade vat-board', async t => { t.is(actualThing, thing, 'must get original value back'); }); -test.skip('upgrade bootstrap vat', async t => { +test.failing('upgrade bootstrap vat', async t => { const { bfile } = t.context; const bundles = { chain: { sourceSpec: bfile('../src/core/boot-chain.js') }, diff --git a/packages/xsnap-lockdown/test/test-inspect.js b/packages/xsnap-lockdown/test/test-inspect.js index f16715a6850..70790b4353a 100644 --- a/packages/xsnap-lockdown/test/test-inspect.js +++ b/packages/xsnap-lockdown/test/test-inspect.js @@ -85,7 +85,7 @@ const testCases = [ ], ]; -test('unconfined inspect', async t => { +test('unconfined inspect', t => { for (const testCase of testCases) { const [toEval, toRender] = Array.isArray(testCase) ? testCase @@ -94,6 +94,7 @@ test('unconfined inspect', async t => { // eslint-disable-next-line no-eval const evaled = (1, eval)(`(${toEval})`); // t.log(evaled); + // eslint-disable-next-line ava/assertion-arguments t.is(unconfinedInspect(evaled), toRender, toEval); } }); diff --git a/packages/xsnap/test/test-boot-lockdown.js b/packages/xsnap/test/test-boot-lockdown.js index 774d7549e6a..3b71f2f4a0d 100644 --- a/packages/xsnap/test/test-boot-lockdown.js +++ b/packages/xsnap/test/test-boot-lockdown.js @@ -66,7 +66,7 @@ test('bootstrap to SES lockdown', async t => { const name = 'SES lockdown worker'; const vat = await xsnap({ ...opts, name }); await vat.evaluate(bootScript); - t.deepEqual([], opts.messages); + t.deepEqual(opts.messages, []); await vat.evaluate(` const encoder = new TextEncoder(); @@ -76,7 +76,7 @@ test('bootstrap to SES lockdown', async t => { send([ typeof harden, typeof Compartment, typeof HandledPromise ]); `); await vat.close(); - t.deepEqual(['["function","function","function"]'], opts.messages); + t.deepEqual(opts.messages, ['["function","function","function"]']); }); test('child compartment cannot access start powers', async t => { @@ -137,7 +137,7 @@ test('TextDecoder under xsnap handles TypedArray and subarrays', async t => { test('console - symbols', async t => { // our console-shim.js handles Symbol specially const { worker: vat, opts } = await bootSESWorker(t); - t.deepEqual([], opts.messages); + t.deepEqual(opts.messages, []); await vat.evaluate(` const encoder = new TextEncoder(); globalThis.send = msg => issueCommand(encoder.encode(JSON.stringify(msg)).buffer); @@ -146,7 +146,7 @@ test('console - symbols', async t => { console.log('console:', Symbol.for('registered')); send('ok'); `); - t.deepEqual(['"ok"'], opts.messages); + t.deepEqual(opts.messages, ['"ok"']); }); test('console - objects should include detail', async t => { diff --git a/packages/xsnap/test/test-gc.js b/packages/xsnap/test/test-gc.js index b900fc09d59..aba27d92075 100644 --- a/packages/xsnap/test/test-gc.js +++ b/packages/xsnap/test/test-gc.js @@ -55,7 +55,7 @@ provokeGC(globalThis.gc).then(data => issueCommand(new TextEncoder().encode(JSON `; await vat.evaluate(code); await vat.close(); - t.truthy(opts.messages.length === 1, `xsnap didn't send response`); + t.true(opts.messages.length === 1, `xsnap didn't send response`); const { wrState, finalizerState } = JSON.parse(opts.messages[0]); // console.log([wrState, finalizerState]); t.is(wrState, 'weakref is dead'); diff --git a/packages/xsnap/test/test-replay.js b/packages/xsnap/test/test-replay.js index 5d353e64ceb..ba4e4a64677 100644 --- a/packages/xsnap/test/test-replay.js +++ b/packages/xsnap/test/test-replay.js @@ -41,7 +41,7 @@ test('record: evaluate and issueCommand', async t => { `issueCommand(new TextEncoder().encode("Hello, World!").buffer);`, ); await vat.close(); - t.deepEqual(['Hello, World!'], opts.messages); + t.deepEqual(opts.messages, ['Hello, World!']); t.deepEqual( transcript1, diff --git a/packages/xsnap/test/test-xs-limits.js b/packages/xsnap/test/test-xs-limits.js index ce5202a17de..d97a5853ead 100644 --- a/packages/xsnap/test/test-xs-limits.js +++ b/packages/xsnap/test/test-xs-limits.js @@ -32,7 +32,7 @@ test('heap exhaustion: orderly fail-stop', async t => { } }); -test.skip('property name space exhaustion: orderly fail-stop', async t => { +test.failing('property name space exhaustion: orderly fail-stop', async t => { const grow = qty => ` const objmap = {}; try { diff --git a/packages/xsnap/test/test-xs-perf.js b/packages/xsnap/test/test-xs-perf.js index efa3cdc20f5..aeeb291d1bc 100644 --- a/packages/xsnap/test/test-xs-perf.js +++ b/packages/xsnap/test/test-xs-perf.js @@ -68,7 +68,7 @@ test('meter details', async t => { // test disabled until rewritten to tolerate fast CI hosts getting // multiple events within the same microsecond, #5951 // (globalThis.performance ? test : test.skip)('meter timestamps', async t => { - +// eslint-disable-next-line ava/no-skip-test test.skip('meter timestamps', async t => { const kernelTimes = []; function addTimestamp(name) { @@ -204,7 +204,7 @@ test('high resolution timer', async t => { `); const [milliseconds] = opts.messages.map(s => JSON.parse(s)); t.log({ milliseconds, date: new Date(milliseconds) }); - t.is('number', typeof milliseconds); + t.is(typeof milliseconds, 'number'); }); test('metering can be switched off / on at run-time', async t => { @@ -254,7 +254,7 @@ test('metering switch - start compartment only', async t => { } `); await vat.close(); - t.deepEqual(['no meteringSwitch in Compartment'], opts.messages); + t.deepEqual(opts.messages, ['no meteringSwitch in Compartment']); }); /** @param {number} logn */ @@ -298,6 +298,7 @@ function dataStructurePerformance(logn) { // Rather than have a very low-probability failing test, we skip this, but // retain the benchmark for future verification in the unlikely event that the // performance character of XS collections regresses. +// eslint-disable-next-line ava/no-skip-test test.skip('Array, Map, Set growth is O(log(n))', async t => { const opts = options(io); const vat = await xsnap({ ...opts, meteringLimit: 0 }); diff --git a/packages/xsnap/test/test-xsnap.js b/packages/xsnap/test/test-xsnap.js index b2f9edc444f..2641aaf93a6 100644 --- a/packages/xsnap/test/test-xsnap.js +++ b/packages/xsnap/test/test-xsnap.js @@ -26,7 +26,7 @@ test('evaluate and issueCommand', async t => { `issueCommand(new TextEncoder().encode("Hello, World!").buffer);`, ); await vat.close(); - t.deepEqual(['Hello, World!'], opts.messages); + t.deepEqual(opts.messages, ['Hello, World!']); }); test('evaluate until idle', async t => { @@ -38,7 +38,7 @@ test('evaluate until idle', async t => { })(); `); await vat.close(); - t.deepEqual(['Hello, World!'], opts.messages); + t.deepEqual(opts.messages, ['Hello, World!']); }); test('evaluate infinite loop', async t => { @@ -49,7 +49,7 @@ test('evaluate infinite loop', async t => { code: ExitCode.E_TOO_MUCH_COMPUTATION, instanceOf: ErrorCode, }); - t.deepEqual([], opts.messages); + t.deepEqual(opts.messages, []); }); // TODO: Re-enable when this doesn't take 3.6 seconds. @@ -69,7 +69,7 @@ test('evaluate promise loop', async t => { instanceOf: ErrorCode, }, ); - t.deepEqual([], opts.messages); + t.deepEqual(opts.messages, []); }); test('evaluate and report', async t => { @@ -84,7 +84,7 @@ test('evaluate and report', async t => { })()`); await vat.close(); const { reply } = result; - t.deepEqual('hi', decode(reply)); + t.is(decode(reply), 'hi'); }); test('evaluate error', async t => { @@ -123,7 +123,7 @@ test('idle includes setImmediate too', async t => { send("turn 1"); `); await vat.close(); - t.deepEqual(['turn 1', 'turn 2', 'end of crank'], opts.messages); + t.deepEqual(opts.messages, ['turn 1', 'turn 2', 'end of crank']); }); test('print - start compartment only', async t => { @@ -172,7 +172,7 @@ test('run script until idle', async t => { const vat = await xsnap(opts); await vat.execute(ld.resolve('fixture-xsnap-script.js')); await vat.close(); - t.deepEqual(['Hello, World!'], opts.messages); + t.deepEqual(opts.messages, ['Hello, World!']); }); test('issueCommand is synchronous inside, async outside', async t => { @@ -191,7 +191,7 @@ test('issueCommand is synchronous inside, async outside', async t => { issueCommand(new TextEncoder().encode(String(number + 1)).buffer); `); await vat.close(); - t.deepEqual([0, 2], messages); + t.deepEqual(messages, [0, 2]); }); test('deliver a message', async t => { @@ -211,7 +211,7 @@ test('deliver a message', async t => { await vat.issueStringCommand('1'); await vat.issueStringCommand('2'); await vat.close(); - t.deepEqual([1, 2, 3], messages); + t.deepEqual(messages, [1, 2, 3]); }); test('receive a response', async t => { @@ -227,9 +227,9 @@ test('receive a response', async t => { return new TextEncoder().encode(String(number + 1)).buffer; }; `); - t.is('1', (await vat.issueStringCommand('0')).reply); - t.is('2', (await vat.issueStringCommand('1')).reply); - t.is('3', (await vat.issueStringCommand('2')).reply); + t.is((await vat.issueStringCommand('0')).reply, '1'); + t.is((await vat.issueStringCommand('1')).reply, '2'); + t.is((await vat.issueStringCommand('2')).reply, '3'); await vat.close(); }); @@ -345,6 +345,7 @@ hashes. const hexHash = hash.digest('hex'); t.log(`${description} produces golden hash ${hexHash}`); + // eslint-disable-next-line ava/assertion-arguments -- xxx, use macros t.snapshot(hexHash, description); t.deepEqual(messages, [], `${description} messages`); } @@ -378,7 +379,7 @@ test('execute immediately after makeSnapshotStream', async t => { `); await vat1.close(); - t.deepEqual(['before'], messages); + t.deepEqual(messages, ['before']); }); function delay(ms) { diff --git a/packages/zoe/test/swingsetTests/zoe/test-zoe.js b/packages/zoe/test/swingsetTests/zoe/test-zoe.js index ba597d38522..2bb284ec0c1 100644 --- a/packages/zoe/test/swingsetTests/zoe/test-zoe.js +++ b/packages/zoe/test/swingsetTests/zoe/test-zoe.js @@ -323,7 +323,7 @@ const expectedBadTimerLog = [ ]; // TODO: Unskip. See https://github.com/Agoric/agoric-sdk/issues/1625 -test.skip('zoe - bad timer', async t => { +test.failing('zoe - bad timer', async t => { const startingValues = [ [3, 0, 0], [0, 0, 0],