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

upgrade to Ava 4.3 #5793

Merged
merged 10 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions golang/cosmos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "@agoric/cosmos",
"version": "0.30.0",
"description": "Connect JS to the Cosmos blockchain SDK",
"parsers": {
"js": "mjs"
},
"main": "src/index.cjs",
"engines": {
"node": ">=14.15.0"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@jessie.js/eslint-plugin": "^0.2.0",
"@types/node": "^16.7.10",
"@typescript-eslint/parser": "^5.30.7",
"ava": "^3.15.0",
"ava": "^4.3.1",
"c8": "^7.11.0",
"conventional-changelog-conventionalcommits": "^4.6.0",
"eslint-config-airbnb-base": "^14.2.0",
Expand Down Expand Up @@ -66,7 +66,7 @@
"timeout": "30m"
},
"dependencies": {
"patch-package": "^6.2.2"
"patch-package": "^6.4.7"
},
"resolutions": {
"**/http-errors/depd": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ERTP/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"devDependencies": {
"@endo/bundle-source": "^2.2.2",
"ava": "^3.12.1",
"ava": "^4.3.1",
"fast-check": "^2.21.0"
},
"files": [
Expand Down
74 changes: 18 additions & 56 deletions packages/ERTP/test/unitTests/test-amountProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import fc from 'fast-check';

import { AmountMath as m, AssetKind } from '../../src/index.js';
import { mockBrand } from './mathHelpers/mockBrand.js';
import { assertionPassed } from '../../../store/test/test-store.js';

// Perhaps makeCopyBag should coalesce duplicate labels, but for now, it does
// not.
Expand Down Expand Up @@ -36,23 +35,13 @@ test('isEqual is a (total) equivalence relation', async t => {
({ x, y, z }) => {
return (
// Total
assertionPassed(t.true([true, false].includes(m.isEqual(x, y))), () =>
[true, false].includes(m.isEqual(x, y)),
) &&
t.true([true, false].includes(m.isEqual(x, y))) &&
// Reflexive
assertionPassed(t.true(m.isEqual(x, x)), () => m.isEqual(x, x)) &&
t.true(m.isEqual(x, x)) &&
// Symmetric
assertionPassed(
t.true(implies(m.isEqual(x, y), m.isEqual(y, x))),
() => implies(m.isEqual(x, y), m.isEqual(y, x)),
) &&
t.true(implies(m.isEqual(x, y), m.isEqual(y, x))) &&
// Transitive
assertionPassed(
t.true(
implies(m.isEqual(x, y) && m.isEqual(y, z), m.isEqual(x, z)),
),
() => implies(m.isEqual(x, y) && m.isEqual(y, z), m.isEqual(x, z)),
)
t.true(implies(m.isEqual(x, y) && m.isEqual(y, z), m.isEqual(x, z)))
);
},
),
Expand All @@ -64,18 +53,13 @@ test('isGTE is a partial order with empty as minimum', async t => {
await fc.assert(
fc.property(fc.record({ x: arbAmount, y: arbAmount }), ({ x, y }) => {
return (
assertionPassed(t.true(m.isGTE(x, empty)), () => m.isGTE(x, empty)) &&
t.true(m.isGTE(x, empty)) &&
// Total
assertionPassed(t.true([true, false].includes(m.isGTE(x, y))), () =>
[true, false].includes(m.isGTE(x, y)),
) &&
t.true([true, false].includes(m.isGTE(x, y))) &&
// Reflexive
assertionPassed(t.true(m.isGTE(x, x)), () => m.isGTE(x, x)) &&
t.true(m.isGTE(x, x)) &&
// Antisymmetric
assertionPassed(
t.true(implies(m.isGTE(x, y) && m.isGTE(y, x), m.isEqual(x, y))),
() => implies(m.isGTE(x, y) && m.isGTE(y, x), m.isEqual(x, y)),
)
t.true(implies(m.isGTE(x, y) && m.isGTE(y, x), m.isEqual(x, y)))
);
}),
);
Expand All @@ -89,34 +73,20 @@ test('add: closed, commutative, associative, monotonic, with empty identity', as
({ x, y, z }) => {
return (
// note: + for SET is not total.
assertionPassed(t.truthy(m.coerce(mockBrand, m.add(x, y))), () =>
m.coerce(mockBrand, m.add(x, y)),
) &&
t.truthy(m.coerce(mockBrand, m.add(x, y))) &&
// Identity (right)
assertionPassed(t.true(m.isEqual(m.add(x, empty), x)), () =>
m.isEqual(m.add(x, empty), x),
) &&
t.true(m.isEqual(m.add(x, empty), x)) &&
// Identity (left)
assertionPassed(t.true(m.isEqual(m.add(empty, x), x)), () =>
m.isEqual(m.add(empty, x), x),
) &&
t.true(m.isEqual(m.add(empty, x), x)) &&
// Commutative
assertionPassed(t.true(m.isEqual(m.add(x, y), m.add(y, x))), () =>
m.isEqual(m.add(x, y), m.add(y, x)),
) &&
t.true(m.isEqual(m.add(x, y), m.add(y, x))) &&
// Associative
assertionPassed(
t.true(m.isEqual(m.add(m.add(x, y), z), m.add(x, m.add(y, z)))),
() => m.isEqual(m.add(m.add(x, y), z), m.add(x, m.add(y, z))),
) &&

t.true(m.isEqual(m.add(m.add(x, y), z), m.add(x, m.add(y, z)))) &&
// Monotonic (left)
assertionPassed(t.true(m.isGTE(m.add(x, y), x)), () =>
m.isGTE(m.add(x, y), x),
) &&
t.true(m.isGTE(m.add(x, y), x)) &&
// Monotonic (right)
assertionPassed(t.true(m.isGTE(m.add(x, y), y)), () =>
m.isGTE(m.add(x, y), y),
)
t.true(m.isGTE(m.add(x, y), y))
);
},
),
Expand All @@ -127,16 +97,8 @@ test('subtract: (x + y) - y = x; (y - x) + x = y if y >= x', async t => {
await fc.assert(
fc.property(fc.record({ x: arbAmount, y: arbAmount }), ({ x, y }) => {
return (
assertionPassed(t.true(m.isEqual(m.subtract(m.add(x, y), y), x)), () =>
m.isEqual(m.subtract(m.add(x, y), y), x),
) &&
assertionPassed(
t.true(
m.isGTE(y, x) ? m.isEqual(m.add(m.subtract(y, x), x), y) : true,
),
() =>
m.isGTE(y, x) ? m.isEqual(m.add(m.subtract(y, x), x), y) : true,
)
t.true(m.isEqual(m.subtract(m.add(x, y), y), x)) &&
t.true(m.isGTE(y, x) ? m.isEqual(m.add(m.subtract(y, x), x), y) : true)
);
}),
);
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"files": [
"test/**/test-*.js"
],
"timeout": "20m"
"timeout": "20m",
"workerThreads": false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this lands, I'd be curious to remove this and see if it affects anything. If "workerThreads" share a JS heap, then we'll probably need to keep it disabled. But maybe they only share a unix process memoryspace, and still have separate instances of the V8 engine (and thus separate JS heaps, so their GC doesn't affect each other), in which case we could use them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I would like to remove this config wherever possible. In my testing these packages failed without this, but maybe we can solve those cases.

},
"publishConfig": {
"access": "public"
Expand Down
Binary file modified packages/SwingSet/test/snapshots/test-state.js.snap
Binary file not shown.
Binary file modified packages/SwingSet/test/snapshots/test-xsnap-store.js.snap
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/access-token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"tmp": "^0.2.1"
},
"devDependencies": {
"ava": "^3.12.1",
"ava": "^4.3.1",
"c8": "^7.7.2"
},
"publishConfig": {
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/.ava-integration-test.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
files: ['integration-tests/test-workflow.js'],
timeout: '10m',
workerThreads: false,
};
5 changes: 3 additions & 2 deletions packages/agoric-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"devDependencies": {
"@agoric/swingset-vat": "^0.28.0",
"ava": "^3.12.1",
"ava": "^4.3.1",
"c8": "^7.11.0",
"tmp": "^0.2.1"
},
Expand Down Expand Up @@ -64,6 +64,7 @@
"files": [
"test/**/test-*.js"
],
"timeout": "2m"
"timeout": "2m",
"workerThreads": false
}
}
1 change: 1 addition & 0 deletions packages/agoric-cli/test/test-publish-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ test('fake publish bundle ok', async t => {
t.is(hostname, 'localhost');
t.is(port, 8080);
t.is(path, '/publish-bundle?accessToken=TO%20KEN');
// @ts-expect-error unknown
t.is(bundle, receivedBundle);
return { ok: true };
},
Expand Down
9 changes: 3 additions & 6 deletions packages/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,14 @@
"url": "https://github.com/Agoric/agoric-sdk/issues"
},
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
"devDependencies": {
"ava": "^3.12.1"
},
"files": [
"src/",
"exported.js",
"NEWS.md"
],
"ava": {
"files": [
"test/**/test-*.js"
"eslintConfig": {
"extends": [
"@agoric"
]
},
"eslintIgnore": [
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@endo/marshal": "^0.6.9"
},
"devDependencies": {
"ava": "^3.12.1",
"ava": "^4.3.1",
"c8": "^7.7.2",
"@agoric/vat-data": "^0.3.1",
"@agoric/zoe": "^0.24.0"
Expand Down
5 changes: 3 additions & 2 deletions packages/casting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"node-fetch": "^2.6.0"
},
"devDependencies": {
"ava": "^3.12.1",
"ava": "^4.3.1",
"c8": "^7.7.2",
"express": "^4.17.1",
"ws": "^7.2.0",
Expand All @@ -50,6 +50,7 @@
"files": [
"test/**/test-*.js"
],
"timeout": "20m"
"timeout": "20m",
"workerThreads": false
}
}
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"tmp": "^0.2.1"
},
"devDependencies": {
"ava": "^3.12.1",
"ava": "^4.3.1",
"c8": "^7.7.2"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/deploy-script-support/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"devDependencies": {
"@agoric/swingset-vat": "^0.28.0",
"ava": "^3.12.1",
"ava": "^4.3.1",
"import-meta-resolve": "^1.1.1"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/governance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@agoric/swingset-vat": "^0.28.0",
"@endo/bundle-source": "^2.2.2",
"@endo/init": "^0.5.43",
"ava": "^3.12.1",
"ava": "^4.3.1",
"c8": "^7.11.0",
"import-meta-resolve": "^1.1.1",
"ses": "^0.15.17"
Expand Down
2 changes: 1 addition & 1 deletion packages/import-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
"devDependencies": {
"@agoric/swingset-vat": "^0.28.0",
"ava": "^3.12.1",
"ava": "^4.3.1",
"c8": "^7.7.2"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/inter-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"devDependencies": {
"@agoric/deploy-script-support": "^0.9.0",
"@endo/init": "^0.5.43",
"ava": "^3.12.1",
"ava": "^4.3.1",
"c8": "^7.11.0",
"deep-object-diff": "^1.1.7",
"fast-check": "^2.21.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { setupAmmServices } from './setup.js';
/** @typedef {Record<string, any> & {
* bundleCache: Awaited<ReturnType<typeof unsafeMakeBundleCache>>,
* }} Context */
/** @type {import('ava').TestInterface<Context>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Context>} */
const test = unknownTest;

test.before(async t => {
Expand Down
3 changes: 1 addition & 2 deletions packages/inter-protocol/test/psm/test-psm.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import {
subscriptionKey,
} from '../supports.js';

/** @type {import('ava').TestInterface<Awaited<ReturnType<makeTestContext>>>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Awaited<ReturnType<makeTestContext>>>} */
const test = anyTest;

const pathname = new URL(import.meta.url).pathname;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ const micro = harden({
* },
* }} StakeFactoryTestContext
*/
/** @type {import('ava').TestInterface<StakeFactoryTestContext>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<StakeFactoryTestContext>} */
const test = unknownTest;

test.before(async t => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'
import zcfBundle from '@agoric/zoe/bundles/bundle-contractFacet.js';
import bundleSource from '@endo/bundle-source';
import { E } from '@endo/eventual-send';
import rawTest from 'ava';
import anyTest from 'ava';

// import '../../../src/vaultFactory/vaultFactory.js';

const dirname = new URL('.', import.meta.url).pathname;

/** @type {import('ava').TestInterface<{ data: { kernelBundles: any, config: any } }>} */
// @ts-expect-error cast
const test = rawTest;
/** @type {import('ava').TestFn<{ data: { kernelBundles: any, config: any } }>} */
const test = anyTest;

test.before(async t => {
const kernelBundles = await buildKernelBundles();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// @ts-check

// eslint-disable-next-line import/no-extraneous-dependencies
import '@endo/init/debug.js';
// eslint-disable-next-line import/no-extraneous-dependencies
import rawTest from 'ava';
import anyTest from 'ava';
import path from 'path';
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
Expand All @@ -17,9 +15,8 @@ import liquidateMinimumBundle from '../../../bundles/bundle-liquidateMinimum.js'
import ammBundle from '../../../bundles/bundle-amm.js';
import vaultFactoryBundle from '../../../bundles/bundle-vaultFactory.js';

/** @type {import('ava').TestInterface<{ data: { kernelBundles: any, config: any } }>} */
// @ts-expect-error cast
const test = rawTest;
/** @type {import('ava').TestFn<{ data: { kernelBundles: any, config: any } }>} */
const test = anyTest;

/**
*
Expand Down
3 changes: 1 addition & 2 deletions packages/inter-protocol/test/test-gov-collateral.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ import { setupBootstrap, setUpZoeForTest, mintRunPayment } from './supports.js';
const { details: X } = assert;
const dirname = url.fileURLToPath(new URL('.', import.meta.url));

/** @type {import('ava').TestInterface<Awaited<ReturnType<typeof makeTestContext>>>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Awaited<ReturnType<typeof makeTestContext>>>} */
const test = anyTest;

const contractRoots = {
Expand Down
3 changes: 1 addition & 2 deletions packages/inter-protocol/test/test-interchainPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import { setUpZoeForTest } from './supports.js';

/** @template T @typedef {import('@endo/promise-kit').PromiseKit<T>} PromiseKit */

/** @type {import('ava').TestInterface<Awaited<ReturnType<makeTestContext>>>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Awaited<ReturnType<makeTestContext>>>} */
const test = anyTest;

const contractRoots = {
Expand Down