diff --git a/packages/bundle-source/test/prepare-test-env-ava.js b/packages/bundle-source/test/prepare-test-env-ava.js deleted file mode 100644 index fdb00169da..0000000000 --- a/packages/bundle-source/test/prepare-test-env-ava.js +++ /dev/null @@ -1,9 +0,0 @@ -/* eslint-disable import/no-extraneous-dependencies */ -import '@endo/init/pre-bundle-source.js'; -import '@endo/lockdown/commit-debug.js'; - -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/bundle-source/test/test-bigint-transform.js b/packages/bundle-source/test/test-bigint-transform.js index 36186c5c11..a790472511 100644 --- a/packages/bundle-source/test/test-bigint-transform.js +++ b/packages/bundle-source/test/test-bigint-transform.js @@ -1,6 +1,7 @@ // @ts-check import url from 'url'; -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; + import bundleSource from '../src/index.js'; test('bigint transform', async t => { diff --git a/packages/bundle-source/test/test-circular.js b/packages/bundle-source/test/test-circular.js index 110787aabd..8f0bc23ad1 100644 --- a/packages/bundle-source/test/test-circular.js +++ b/packages/bundle-source/test/test-circular.js @@ -1,5 +1,6 @@ import url from 'url'; -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; + import bundleSource from '../src/index.js'; function evaluate(src, endowments) { diff --git a/packages/bundle-source/test/test-comment.js b/packages/bundle-source/test/test-comment.js index 88a60f54e2..7b6e330f30 100644 --- a/packages/bundle-source/test/test-comment.js +++ b/packages/bundle-source/test/test-comment.js @@ -1,5 +1,5 @@ -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; + import url from 'url'; import { decodeBase64 } from '@endo/base64'; import { parseArchive } from '@endo/compartment-mapper/import-archive.js'; diff --git a/packages/bundle-source/test/test-explicit.js b/packages/bundle-source/test/test-explicit.js index f47d80a5da..8b6118f8d2 100644 --- a/packages/bundle-source/test/test-explicit.js +++ b/packages/bundle-source/test/test-explicit.js @@ -2,7 +2,8 @@ import { rollup } from 'rollup'; import { resolve as pathResolve } from 'path'; import resolvePlugin from '@rollup/plugin-node-resolve'; import url from 'url'; -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; + import bundleSource from '../src/index.js'; test('explicit authority', async t => { diff --git a/packages/bundle-source/test/test-external-fs.js b/packages/bundle-source/test/test-external-fs.js index 0950c0aeb2..748fd09ab9 100644 --- a/packages/bundle-source/test/test-external-fs.js +++ b/packages/bundle-source/test/test-external-fs.js @@ -1,5 +1,6 @@ import url from 'url'; -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; + import bundleSource from '../src/index.js'; function evaluate(src, endowments) { diff --git a/packages/bundle-source/test/test-integrity.js b/packages/bundle-source/test/test-integrity.js index 64bfc06a99..80e268e8e2 100644 --- a/packages/bundle-source/test/test-integrity.js +++ b/packages/bundle-source/test/test-integrity.js @@ -1,5 +1,6 @@ import url from 'url'; -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; + import bundleSource from '../src/index.js'; test('integrity check', async t => { diff --git a/packages/bundle-source/test/test-tool-command.js b/packages/bundle-source/test/test-tool-command.js index 73ecd85d9a..a045f6f5c6 100644 --- a/packages/bundle-source/test/test-tool-command.js +++ b/packages/bundle-source/test/test-tool-command.js @@ -1,11 +1,8 @@ -import '@endo/init'; +import test from '@endo/ses-ava/prepare-endo.js'; + import url from 'url'; -import rawTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; import { execava } from './execava.js'; -const test = wrapTest(rawTest); - const cwd = url.fileURLToPath(new URL('..', import.meta.url)); const opts = { cwd }; diff --git a/packages/bundle-source/test/test-tool-library.js b/packages/bundle-source/test/test-tool-library.js index f14322d034..e827655b87 100644 --- a/packages/bundle-source/test/test-tool-library.js +++ b/packages/bundle-source/test/test-tool-library.js @@ -1,12 +1,9 @@ /* global process */ -import '@endo/init'; +import test from '@endo/ses-ava/prepare-endo.js'; + import url from 'url'; -import rawTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; import { makeNodeBundleCache } from '../cache.js'; -const test = wrapTest(rawTest); - test('bundle-source library is concurrency safe', async t => { const dest = url.fileURLToPath(new URL('../bundles', import.meta.url)); const bundleEntry = url.fileURLToPath( diff --git a/packages/captp/test/prepare-test-env-ava.js b/packages/captp/test/prepare-test-env-ava.js deleted file mode 100644 index face992d1d..0000000000 --- a/packages/captp/test/prepare-test-env-ava.js +++ /dev/null @@ -1,8 +0,0 @@ -import '@endo/init/pre-remoting.js'; -import '@endo/init/debug.js'; - -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/captp/test/test-crosstalk.js b/packages/captp/test/test-crosstalk.js index a76efd5242..7fe3ed1d20 100644 --- a/packages/captp/test/test-crosstalk.js +++ b/packages/captp/test/test-crosstalk.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { Far } from '@endo/marshal'; import { makeLoopback, E } from '../src/loopback.js'; diff --git a/packages/captp/test/test-disco.js b/packages/captp/test/test-disco.js index 3a3fab8af8..84f2a798dd 100644 --- a/packages/captp/test/test-disco.js +++ b/packages/captp/test/test-disco.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { Far } from '@endo/marshal'; import { E, makeCapTP } from '../src/captp.js'; diff --git a/packages/captp/test/test-export-hook.js b/packages/captp/test/test-export-hook.js index 5f42e7833b..541e44708e 100644 --- a/packages/captp/test/test-export-hook.js +++ b/packages/captp/test/test-export-hook.js @@ -1,8 +1,7 @@ // @ts-check /* global globalThis */ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { Far } from '@endo/marshal'; import { E, makeLoopback } from '../src/loopback.js'; diff --git a/packages/captp/test/test-finalizing-map.js b/packages/captp/test/test-finalizing-map.js index ca104618e6..73f0eb0819 100644 --- a/packages/captp/test/test-finalizing-map.js +++ b/packages/captp/test/test-finalizing-map.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { detectEngineGC } from './engine-gc.js'; import { makeGcAndFinalize } from './gc-and-finalize.js'; diff --git a/packages/captp/test/test-gc.js b/packages/captp/test/test-gc.js index 3ccfa5d5a2..af3eb3622c 100644 --- a/packages/captp/test/test-gc.js +++ b/packages/captp/test/test-gc.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { Far } from '@endo/marshal'; import { E, makeLoopback } from '../src/loopback.js'; diff --git a/packages/captp/test/test-loopback.js b/packages/captp/test/test-loopback.js index 887abac11b..15d0702f46 100644 --- a/packages/captp/test/test-loopback.js +++ b/packages/captp/test/test-loopback.js @@ -1,7 +1,6 @@ /* global setTimeout */ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { Far } from '@endo/marshal'; import { E, makeLoopback } from '../src/loopback.js'; diff --git a/packages/captp/test/test-trap.js b/packages/captp/test/test-trap.js index 650af46f5f..3ec5d2cb39 100644 --- a/packages/captp/test/test-trap.js +++ b/packages/captp/test/test-trap.js @@ -1,5 +1,4 @@ -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { Worker } from 'worker_threads'; import url from 'url'; diff --git a/packages/common/test/prepare-test-env-ava.js b/packages/common/test/prepare-test-env-ava.js deleted file mode 100644 index f5ed7c0c84..0000000000 --- a/packages/common/test/prepare-test-env-ava.js +++ /dev/null @@ -1,9 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import '@endo/init/debug.js'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/common/test/test-apply-labeling-error.js b/packages/common/test/test-apply-labeling-error.js index e43603f17f..9af308764a 100644 --- a/packages/common/test/test-apply-labeling-error.js +++ b/packages/common/test/test-apply-labeling-error.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { Fail } from '@endo/errors'; import { applyLabelingError } from '../apply-labeling-error.js'; diff --git a/packages/common/test/test-from-unique-entries.js b/packages/common/test/test-from-unique-entries.js index 5d087e893c..c2c3286de0 100644 --- a/packages/common/test/test-from-unique-entries.js +++ b/packages/common/test/test-from-unique-entries.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { fromUniqueEntries } from '../from-unique-entries.js'; test('test fromUniqueEntries', async t => { diff --git a/packages/common/test/test-ident-checker.js b/packages/common/test/test-ident-checker.js index ba07dc689e..32be57c4a3 100644 --- a/packages/common/test/test-ident-checker.js +++ b/packages/common/test/test-ident-checker.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { identChecker } from '../ident-checker.js'; test('test identChecker', async t => { diff --git a/packages/common/test/test-list-difference.js b/packages/common/test/test-list-difference.js index fd7f33d639..f526bd86df 100644 --- a/packages/common/test/test-list-difference.js +++ b/packages/common/test/test-list-difference.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { listDifference } from '../list-difference.js'; test('test listDifference', async t => { diff --git a/packages/common/test/test-make-array-iterator.js b/packages/common/test/test-make-array-iterator.js index 0c5b3f56dd..9fd7979b81 100644 --- a/packages/common/test/test-make-array-iterator.js +++ b/packages/common/test/test-make-array-iterator.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { makeArrayIterator } from '../make-array-iterator.js'; // Also serves as an adequate test of make-iterator.js diff --git a/packages/common/test/test-object-map.js b/packages/common/test/test-object-map.js index 6500ca5088..6d3fcfb81d 100644 --- a/packages/common/test/test-object-map.js +++ b/packages/common/test/test-object-map.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { objectMap } from '../object-map.js'; test('test objectMap', async t => { diff --git a/packages/common/test/test-object-meta-assign.js b/packages/common/test/test-object-meta-assign.js index 43962b3960..5a27316091 100644 --- a/packages/common/test/test-object-meta-assign.js +++ b/packages/common/test/test-object-meta-assign.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { objectMetaAssign } from '../object-meta-assign.js'; test('test objectMetaAssign', async t => { diff --git a/packages/common/test/test-object-meta-map.js b/packages/common/test/test-object-meta-map.js index b24bc810e4..66a06d6d3f 100644 --- a/packages/common/test/test-object-meta-map.js +++ b/packages/common/test/test-object-meta-map.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { objectMetaMap } from '../object-meta-map.js'; const { getOwnPropertyDescriptors, getPrototypeOf } = Object; diff --git a/packages/common/test/test-throw-labeled.js b/packages/common/test/test-throw-labeled.js index e625338950..010976b33a 100644 --- a/packages/common/test/test-throw-labeled.js +++ b/packages/common/test/test-throw-labeled.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { throwLabeled } from '../throw-labeled.js'; test('test throwLabeled', async t => { diff --git a/packages/daemon/test/test-pubsub.js b/packages/daemon/test/test-pubsub.js index c187bbdbbc..ca46e3cfbc 100644 --- a/packages/daemon/test/test-pubsub.js +++ b/packages/daemon/test/test-pubsub.js @@ -1,15 +1,11 @@ // @ts-check /* eslint-disable no-await-in-loop */ -import '@endo/init/debug.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -import rawTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; import { makePromiseKit } from '@endo/promise-kit'; import { makeChangeTopic } from '../src/pubsub.js'; -const test = wrapTest(rawTest); - test('change topic supports parallel subscriptions', async (/** @type {import('ava').Assertions} */ t) => { const { publisher, subscribe } = makeChangeTopic(); diff --git a/packages/daemon/test/test-serial-jobs.js b/packages/daemon/test/test-serial-jobs.js index 9744975121..52dd9c001c 100644 --- a/packages/daemon/test/test-serial-jobs.js +++ b/packages/daemon/test/test-serial-jobs.js @@ -1,13 +1,8 @@ /* global setTimeout */ -import '@endo/init/debug.js'; - -import rawTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; +import test from '@endo/ses-ava/prepare-endo.js'; import { makeSerialJobs } from '../src/serial-jobs.js'; -const test = wrapTest(rawTest); - const delay = () => new Promise(resolve => setTimeout(resolve, 1)); test('performs operations in expected order (sync functions)', async t => { diff --git a/packages/errors/test/prepare-test-env-ava.js b/packages/errors/test/prepare-test-env-ava.js deleted file mode 100644 index f5ed7c0c84..0000000000 --- a/packages/errors/test/prepare-test-env-ava.js +++ /dev/null @@ -1,9 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import '@endo/init/debug.js'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/errors/test/test-index.js b/packages/errors/test/test-index.js index 8690b08dd3..15789bf936 100644 --- a/packages/errors/test/test-index.js +++ b/packages/errors/test/test-index.js @@ -1,5 +1,6 @@ // Sets up a SES environment with 'assert' global -import { test } from './prepare-test-env-ava.js'; +import '@endo/lockdown/commit-debug.js'; +import test from 'ava'; import { assert, throwRedacted } from '../index.js'; diff --git a/packages/evasive-transform/test/prepare-test-env-ava.js b/packages/evasive-transform/test/prepare-test-env-ava-fixture.js similarity index 64% rename from packages/evasive-transform/test/prepare-test-env-ava.js rename to packages/evasive-transform/test/prepare-test-env-ava-fixture.js index 15fb4dc721..bb0d927469 100644 --- a/packages/evasive-transform/test/prepare-test-env-ava.js +++ b/packages/evasive-transform/test/prepare-test-env-ava-fixture.js @@ -1,14 +1,8 @@ import path from 'node:path'; import fs from 'node:fs/promises'; import url from 'url'; -import rawTest from 'ava'; -// eslint-disable-next-line import/no-extraneous-dependencies -import '@endo/init/debug.js'; - -// eslint-disable-next-line import/no-extraneous-dependencies -// @ts-expect-error - no types -import { wrapTest } from '@endo/ses-ava'; +import test from '@endo/ses-ava/prepare-endo.js'; /** * Path to fixture's bundled source code @@ -34,16 +28,6 @@ const fixtureSourceMapPath = path.resolve( ), ); -/** - * @typedef TransformsTestContext - * @property {string} source - Fixture source - * @property {string} sourceMap - Fixture source map - * @property {string} sourceUrl - Relative fixture source filepath - */ - -/** @type {import('ava').TestFn} */ -export const test = wrapTest(rawTest); - /** * Put fixture into the test context */ @@ -61,3 +45,5 @@ test.before(async t => { 'Absolute source URL will befoul snapshots', ); }); + +export { test }; diff --git a/packages/evasive-transform/test/test-evade-censor.js b/packages/evasive-transform/test/test-evade-censor.js index 978e2af17d..24e436650b 100644 --- a/packages/evasive-transform/test/test-evade-censor.js +++ b/packages/evasive-transform/test/test-evade-censor.js @@ -1,5 +1,5 @@ import { evadeCensor } from '../src/index.js'; -import { test } from './prepare-test-env-ava.js'; +import { test } from './prepare-test-env-ava-fixture.js'; /** * Removes all linefeeds from string diff --git a/packages/evasive-transform/test/test-location-unmapper.js b/packages/evasive-transform/test/test-location-unmapper.js index a375a52af5..b6c14e5eaa 100644 --- a/packages/evasive-transform/test/test-location-unmapper.js +++ b/packages/evasive-transform/test/test-location-unmapper.js @@ -1,6 +1,6 @@ import babelParser from '@babel/parser'; import { makeLocationUnmapper } from '../src/location-unmapper.js'; -import { test } from './prepare-test-env-ava.js'; +import { test } from './prepare-test-env-ava-fixture.js'; const { parse: parseBabel } = babelParser; diff --git a/packages/evasive-transform/test/test-transform-comment.js b/packages/evasive-transform/test/test-transform-comment.js index 6a13033836..ce203f1589 100644 --- a/packages/evasive-transform/test/test-transform-comment.js +++ b/packages/evasive-transform/test/test-transform-comment.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import { test } from './prepare-test-env-ava-fixture.js'; import { transformComment } from '../src/transform-comment.js'; test('transformComment() - Node type becomes CommentBlock', async t => { @@ -31,7 +31,7 @@ test('transformComment() - rewrite suspicious import(...)', async t => { const comment = /** @type {import('@babel/types').Comment} */ ({ type: 'CommentBlock', value: `/** - * @type {import('c:\\My Documents\\user.js')} + * @type {import('c:\\My Documents\\user.js')} */`, }); transformComment(comment); diff --git a/packages/eventual-send/package.json b/packages/eventual-send/package.json index 7098d0d9a4..b995888b4b 100644 --- a/packages/eventual-send/package.json +++ b/packages/eventual-send/package.json @@ -40,7 +40,6 @@ }, "devDependencies": { "@endo/lockdown": "^1.0.4", - "@endo/ses-ava": "^1.1.2", "ava": "^5.3.0", "c8": "^7.14.0", "tsd": "^0.28.1" diff --git a/packages/eventual-send/test/prepare-test-env-ava.js b/packages/eventual-send/test/prepare-test-env-ava.js deleted file mode 100644 index 4ffbab4e77..0000000000 --- a/packages/eventual-send/test/prepare-test-env-ava.js +++ /dev/null @@ -1,14 +0,0 @@ -/* global globalThis */ - -import '@endo/lockdown/commit-debug.js'; - -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -export * from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); - -const env = (globalThis.process || {}).env || {}; -env.TRACK_TURNS = 'enabled'; diff --git a/packages/eventual-send/test/test-deep-send.js b/packages/eventual-send/test/test-deep-send.js index 3d4c652476..299d951493 100644 --- a/packages/eventual-send/test/test-deep-send.js +++ b/packages/eventual-send/test/test-deep-send.js @@ -2,8 +2,8 @@ // automated test. Rather, its purpose is just to run it to see what a // deep stack looks like. -// eslint-disable-next-line import/no-extraneous-dependencies -import { test } from './prepare-test-env-ava.js'; +import '@endo/lockdown/commit-debug.js'; +import test from 'ava'; import { E } from './get-hp.js'; diff --git a/packages/eventual-send/test/test-deep-stacks.js b/packages/eventual-send/test/test-deep-stacks.js index 40ad769bed..208eff7c23 100644 --- a/packages/eventual-send/test/test-deep-stacks.js +++ b/packages/eventual-send/test/test-deep-stacks.js @@ -2,7 +2,8 @@ // automated test. Rather, its purpose is just to run it to see what a // deep stack looks like. -import { test } from './prepare-test-env-ava.js'; +import '@endo/lockdown/commit-debug.js'; +import test from 'ava'; import { E } from './get-hp.js'; diff --git a/packages/eventual-send/test/test-e.js b/packages/eventual-send/test/test-e.js index 9155ee9b50..a0f1c05c31 100644 --- a/packages/eventual-send/test/test-e.js +++ b/packages/eventual-send/test/test-e.js @@ -1,4 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import '@endo/lockdown/commit-debug.js'; +import test from 'ava'; import { E, HandledPromise } from './get-hp.js'; diff --git a/packages/eventual-send/test/test-eventual-send.js b/packages/eventual-send/test/test-eventual-send.js index 41bd8a9c1e..65088e247a 100644 --- a/packages/eventual-send/test/test-eventual-send.js +++ b/packages/eventual-send/test/test-eventual-send.js @@ -1,5 +1,6 @@ /* global setTimeout */ -import { test } from './prepare-test-env-ava.js'; +import '@endo/lockdown/commit-debug.js'; +import test from 'ava'; import { HandledPromise } from './get-hp.js'; diff --git a/packages/eventual-send/test/test-hp.js b/packages/eventual-send/test/test-hp.js index ba808da5d2..6ff0a9e9a1 100644 --- a/packages/eventual-send/test/test-hp.js +++ b/packages/eventual-send/test/test-hp.js @@ -1,4 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import '@endo/lockdown/commit-debug.js'; +import test from 'ava'; import { HandledPromise } from './get-hp.js'; diff --git a/packages/eventual-send/test/test-proxy.js b/packages/eventual-send/test/test-proxy.js index 5b0f93a647..3a7f459b91 100644 --- a/packages/eventual-send/test/test-proxy.js +++ b/packages/eventual-send/test/test-proxy.js @@ -1,5 +1,5 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { test } from './prepare-test-env-ava.js'; +import '@endo/lockdown/commit-debug.js'; +import test from 'ava'; import { HandledPromise } from './get-hp.js'; diff --git a/packages/eventual-send/test/test-thenable.js b/packages/eventual-send/test/test-thenable.js index d9d8e71b45..2d52914b19 100644 --- a/packages/eventual-send/test/test-thenable.js +++ b/packages/eventual-send/test/test-thenable.js @@ -1,4 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import '@endo/lockdown/commit-debug.js'; +import test from 'ava'; import { E, HandledPromise } from './get-hp.js'; diff --git a/packages/eventual-send/test/test-types.js b/packages/eventual-send/test/test-types.js index 21f0343d8a..6b83bb9c20 100644 --- a/packages/eventual-send/test/test-types.js +++ b/packages/eventual-send/test/test-types.js @@ -1,4 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import '@endo/lockdown/commit-debug.js'; +import test from 'ava'; import { E } from './get-hp.js'; diff --git a/packages/exo/test/prepare-test-env-ava-label-instances.js b/packages/exo/test/prepare-test-env-ava-label-instances.js index ebab0df8f7..dbe5ec8b1c 100644 --- a/packages/exo/test/prepare-test-env-ava-label-instances.js +++ b/packages/exo/test/prepare-test-env-ava-label-instances.js @@ -1,7 +1,18 @@ /* global globalThis */ -export * from './prepare-test-env-ava.js'; +import { environmentOptionsListHas } from '@endo/env-options'; +import test from '@endo/ses-ava/prepare-endo.js'; +// TODO consider adding env option setting APIs to @endo/env-options +// TODO should set up globalThis.process.env if absent const env = (globalThis.process || {}).env || {}; +if (!environmentOptionsListHas('DEBUG', 'label-instances')) { + if ('DEBUG' in env) { + env.DEBUG = `${env.DEBUG},label-instances`; + } else { + env.DEBUG = 'label-instances'; + } +} -env.DEBUG = 'label-instances'; +// eslint-disable-next-line no-restricted-exports +export { test as default }; diff --git a/packages/exo/test/prepare-test-env-ava.js b/packages/exo/test/prepare-test-env-ava.js deleted file mode 100644 index f5ed7c0c84..0000000000 --- a/packages/exo/test/prepare-test-env-ava.js +++ /dev/null @@ -1,9 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import '@endo/init/debug.js'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/exo/test/test-amplify-heap-class-kits.js b/packages/exo/test/test-amplify-heap-class-kits.js index 7e827d22de..312c67d366 100644 --- a/packages/exo/test/test-amplify-heap-class-kits.js +++ b/packages/exo/test/test-amplify-heap-class-kits.js @@ -1,9 +1,6 @@ // modeled on test-heap-classes.js +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; - -// eslint-disable-next-line import/order import { M } from '@endo/patterns'; import { defineExoClass, defineExoClassKit } from '../src/exo-makers.js'; diff --git a/packages/exo/test/test-exo-class-js-class.js b/packages/exo/test/test-exo-class-js-class.js index 8cc19eae56..fca6bfdf10 100644 --- a/packages/exo/test/test-exo-class-js-class.js +++ b/packages/exo/test/test-exo-class-js-class.js @@ -1,7 +1,6 @@ /* eslint-disable max-classes-per-file */ /* eslint-disable class-methods-use-this */ -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { passStyleOf } from '@endo/pass-style'; import { M, getInterfaceGuardPayload } from '@endo/patterns'; diff --git a/packages/exo/test/test-exo-wobbly-point.js b/packages/exo/test/test-exo-wobbly-point.js index 4850ad5b2f..1553ded80a 100644 --- a/packages/exo/test/test-exo-wobbly-point.js +++ b/packages/exo/test/test-exo-wobbly-point.js @@ -7,10 +7,8 @@ /* eslint-disable class-methods-use-this */ /* eslint-disable max-classes-per-file */ -/* eslint-disable-next-line import/order */ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { getMethodNames } from '@endo/eventual-send/utils.js'; import { passStyleOf, Far, GET_METHOD_NAMES } from '@endo/pass-style'; import { M } from '@endo/patterns'; diff --git a/packages/exo/test/test-heap-classes.js b/packages/exo/test/test-heap-classes.js index 45f8595b3c..c65624a479 100644 --- a/packages/exo/test/test-heap-classes.js +++ b/packages/exo/test/test-heap-classes.js @@ -1,8 +1,6 @@ // @ts-check -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { getInterfaceMethodKeys, M } from '@endo/patterns'; import { GET_INTERFACE_GUARD, diff --git a/packages/exo/test/test-is-instance-heap-class-kits.js b/packages/exo/test/test-is-instance-heap-class-kits.js index 2274ac43c4..a7303a56c1 100644 --- a/packages/exo/test/test-is-instance-heap-class-kits.js +++ b/packages/exo/test/test-is-instance-heap-class-kits.js @@ -1,9 +1,7 @@ // modeled on test-heap-classes.js -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { M } from '@endo/patterns'; import { defineExoClass, defineExoClassKit } from '../src/exo-makers.js'; diff --git a/packages/exo/test/test-label-instances.js b/packages/exo/test/test-label-instances.js index 8fff031504..7395fdd4f5 100644 --- a/packages/exo/test/test-label-instances.js +++ b/packages/exo/test/test-label-instances.js @@ -1,5 +1,5 @@ // eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava-label-instances.js'; +import test from './prepare-test-env-ava-label-instances.js'; // eslint-disable-next-line import/order import { passStyleOf } from '@endo/far'; diff --git a/packages/exo/test/test-legacy-guard-tolerance.js b/packages/exo/test/test-legacy-guard-tolerance.js index 652cc4d1c1..ec15546b58 100644 --- a/packages/exo/test/test-legacy-guard-tolerance.js +++ b/packages/exo/test/test-legacy-guard-tolerance.js @@ -1,6 +1,5 @@ // @ts-check -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { passStyleOf } from '@endo/pass-style'; import { diff --git a/packages/exo/test/test-non-enumerable-methods.js b/packages/exo/test/test-non-enumerable-methods.js index 24b28bd3ad..fb51812c43 100644 --- a/packages/exo/test/test-non-enumerable-methods.js +++ b/packages/exo/test/test-non-enumerable-methods.js @@ -1,7 +1,5 @@ -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { objectMetaMap } from '@endo/common/object-meta-map.js'; import { getInterfaceMethodKeys, M } from '@endo/patterns'; import { defineExoClass } from '../src/exo-makers.js'; diff --git a/packages/far/test/prepare-test-env-ava.js b/packages/far/test/prepare-test-env-ava.js deleted file mode 100644 index 914bdaa276..0000000000 --- a/packages/far/test/prepare-test-env-ava.js +++ /dev/null @@ -1,7 +0,0 @@ -import '@endo/init/debug.js'; - -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/far/test/test-e.js b/packages/far/test/test-e.js index 2cc2fb4387..f3c617a8f2 100644 --- a/packages/far/test/test-e.js +++ b/packages/far/test/test-e.js @@ -1,7 +1,6 @@ /* eslint-disable max-classes-per-file */ /* eslint-disable class-methods-use-this */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { E } from '../src/index.js'; diff --git a/packages/far/test/test-marshal-far-function.js b/packages/far/test/test-marshal-far-function.js index a514d3b240..c86c2b1fb6 100644 --- a/packages/far/test/test-marshal-far-function.js +++ b/packages/far/test/test-marshal-far-function.js @@ -1,6 +1,6 @@ // @ts-check -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { Far, getInterfaceOf, passStyleOf } from '../src/index.js'; diff --git a/packages/far/test/test-marshal-far-obj.js b/packages/far/test/test-marshal-far-obj.js index 404e3d64c4..773b6d885b 100644 --- a/packages/far/test/test-marshal-far-obj.js +++ b/packages/far/test/test-marshal-far-obj.js @@ -1,7 +1,6 @@ // @ts-check -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { q } from '@endo/errors'; import { Far, passStyleOf, getInterfaceOf } from '../src/index.js'; diff --git a/packages/import-bundle/test/prepare-test-env-ava.js b/packages/import-bundle/test/prepare-test-env-ava.js deleted file mode 100644 index 8f72bf152b..0000000000 --- a/packages/import-bundle/test/prepare-test-env-ava.js +++ /dev/null @@ -1,8 +0,0 @@ -import '@endo/init/pre-bundle-source.js'; -import '@endo/init/debug.js'; - -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/import-bundle/test/test-compartment-wrapper.js b/packages/import-bundle/test/test-compartment-wrapper.js index 12c691f9b3..beca267723 100644 --- a/packages/import-bundle/test/test-compartment-wrapper.js +++ b/packages/import-bundle/test/test-compartment-wrapper.js @@ -1,7 +1,6 @@ /// +import test from '@endo/ses-ava/prepare-endo.js'; -import { test } from './prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import { wrapInescapableCompartment } from '../src/compartment-wrapper.js'; const createChild = `() => new Compartment({console})`; diff --git a/packages/import-bundle/test/test-import-bundle.js b/packages/import-bundle/test/test-import-bundle.js index 22956c73c3..7599bf7f2e 100644 --- a/packages/import-bundle/test/test-import-bundle.js +++ b/packages/import-bundle/test/test-import-bundle.js @@ -1,5 +1,5 @@ -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; + import { encodeBase64 } from '@endo/base64'; import fs from 'fs'; import url from 'url'; diff --git a/packages/init/package.json b/packages/init/package.json index 05eba06263..1c951aeba7 100644 --- a/packages/init/package.json +++ b/packages/init/package.json @@ -30,8 +30,7 @@ }, "devDependencies": { "@endo/compartment-mapper": "^1.1.2", - "@endo/ses-ava": "^1.1.2", - "ava": "^5.1.1" + "ava": "^5.3.0" }, "dependencies": { "@endo/base64": "^1.0.2", diff --git a/packages/init/test/test-bundle.js b/packages/init/test/test-bundle.js index 54c464a267..7c3e0c76fe 100644 --- a/packages/init/test/test-bundle.js +++ b/packages/init/test/test-bundle.js @@ -5,14 +5,11 @@ import url, { URL } from 'url'; import crypto from 'crypto'; import '../debug.js'; -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; +import test from 'ava'; import { makeArchive } from '@endo/compartment-mapper'; import { makeReadPowers } from '@endo/compartment-mapper/node-powers.js'; -const test = wrapTest(rawTest); - test('Can be bundled', async t => { const powers = makeReadPowers({ fs, url, crypto }); diff --git a/packages/lp32/test/test-lp32.js b/packages/lp32/test/test-lp32.js index fb260baa68..b3ba3d8ada 100644 --- a/packages/lp32/test/test-lp32.js +++ b/packages/lp32/test/test-lp32.js @@ -1,10 +1,6 @@ /* global setTimeout */ // @ts-check - -import '@endo/init/debug.js'; - -import rawTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; +import test from '@endo/ses-ava/prepare-endo.js'; import { makePipe } from '@endo/stream'; import { makeLp32Reader } from '../reader.js'; @@ -14,8 +10,6 @@ import { hostIsLittleEndian } from '../src/host-endian.js'; const encoder = new TextEncoder(); const decoder = new TextDecoder(); -const test = wrapTest(rawTest); - /** * @param {import('@endo/stream').Stream} reader */ diff --git a/packages/marshal/test/prepare-test-env-ava.js b/packages/marshal/test/prepare-test-env-ava.js deleted file mode 100644 index cc67801b3f..0000000000 --- a/packages/marshal/test/prepare-test-env-ava.js +++ /dev/null @@ -1,10 +0,0 @@ -// @ts-nocheck -// eslint-disable-next-line import/no-extraneous-dependencies -import '@endo/init/debug.js'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/marshal/test/test-dot-membrane.js b/packages/marshal/test/test-dot-membrane.js index 045b540217..b600d88913 100644 --- a/packages/marshal/test/test-dot-membrane.js +++ b/packages/marshal/test/test-dot-membrane.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { Far } from '@endo/pass-style'; import { makeDotMembraneKit } from '../src/dot-membrane.js'; diff --git a/packages/marshal/test/test-encode-slot-in-promise.js b/packages/marshal/test/test-encode-slot-in-promise.js index baf5ee6e13..76365c3e60 100644 --- a/packages/marshal/test/test-encode-slot-in-promise.js +++ b/packages/marshal/test/test-encode-slot-in-promise.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { passStyleOf } from '@endo/pass-style'; import { makeMarshal } from '../src/marshal.js'; diff --git a/packages/marshal/test/test-encodePassable.js b/packages/marshal/test/test-encodePassable.js index 5447deba8e..6583479efe 100644 --- a/packages/marshal/test/test-encodePassable.js +++ b/packages/marshal/test/test-encodePassable.js @@ -1,16 +1,12 @@ // @ts-nocheck /* eslint-disable no-bitwise, @endo/restrict-comparison-operands */ -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { fc } from '@fast-check/ava'; import { Remotable } from '@endo/pass-style'; import { arbPassable } from '@endo/pass-style/tools.js'; import { Fail, q } from '@endo/errors'; -// eslint-disable-next-line import/no-extraneous-dependencies - import { makePassableKit, makeEncodePassable, diff --git a/packages/marshal/test/test-marshal-capdata.js b/packages/marshal/test/test-marshal-capdata.js index 10712862a3..3e14762753 100644 --- a/packages/marshal/test/test-marshal-capdata.js +++ b/packages/marshal/test/test-marshal-capdata.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { passStyleOf, Far } from '@endo/pass-style'; import { makeMarshal } from '../src/marshal.js'; import { roundTripPairs } from './marshal-test-data.js'; diff --git a/packages/marshal/test/test-marshal-far-function.js b/packages/marshal/test/test-marshal-far-function.js index 01fd9a0a2d..b546b11621 100644 --- a/packages/marshal/test/test-marshal-far-function.js +++ b/packages/marshal/test/test-marshal-far-function.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { getInterfaceOf, passStyleOf, Far } from '@endo/pass-style'; const { freeze, setPrototypeOf } = Object; diff --git a/packages/marshal/test/test-marshal-far-obj.js b/packages/marshal/test/test-marshal-far-obj.js index 9ff4e053f1..c9cba7bc9d 100644 --- a/packages/marshal/test/test-marshal-far-obj.js +++ b/packages/marshal/test/test-marshal-far-obj.js @@ -1,5 +1,4 @@ -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { q } from '@endo/errors'; import { passStyleOf, Remotable, Far, getInterfaceOf } from '@endo/pass-style'; diff --git a/packages/marshal/test/test-marshal-justin.js b/packages/marshal/test/test-marshal-justin.js index 8ff70d1eea..d72c57e95c 100644 --- a/packages/marshal/test/test-marshal-justin.js +++ b/packages/marshal/test/test-marshal-justin.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { Remotable, makeTagged } from '@endo/pass-style'; import { makeMarshal } from '../src/marshal.js'; import { decodeToJustin } from '../src/marshal-justin.js'; diff --git a/packages/marshal/test/test-marshal-serialization.js b/packages/marshal/test/test-marshal-serialization.js index 4f2f95440a..f75b0e90e2 100644 --- a/packages/marshal/test/test-marshal-serialization.js +++ b/packages/marshal/test/test-marshal-serialization.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { makeMarshal } from '../src/marshal.js'; test('toCapData', t => { diff --git a/packages/marshal/test/test-marshal-smallcaps.js b/packages/marshal/test/test-marshal-smallcaps.js index 917d7e03d0..ce5f1a763a 100644 --- a/packages/marshal/test/test-marshal-smallcaps.js +++ b/packages/marshal/test/test-marshal-smallcaps.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { Far, makeTagged, passStyleOf } from '@endo/pass-style'; import { makeMarshal } from '../src/marshal.js'; diff --git a/packages/marshal/test/test-marshal-stringify.js b/packages/marshal/test/test-marshal-stringify.js index 3d6490502b..8272c96389 100644 --- a/packages/marshal/test/test-marshal-stringify.js +++ b/packages/marshal/test/test-marshal-stringify.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { Far } from '@endo/pass-style'; import { stringify, parse } from '../src/marshal-stringify.js'; import { roundTripPairs } from './marshal-test-data.js'; diff --git a/packages/marshal/test/test-marshal-testing.js b/packages/marshal/test/test-marshal-testing.js index 460986225f..61a6161ee3 100644 --- a/packages/marshal/test/test-marshal-testing.js +++ b/packages/marshal/test/test-marshal-testing.js @@ -1,6 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { passStyleOf, Remotable } from '@endo/pass-style'; import { makeMarshal } from '../src/marshal.js'; diff --git a/packages/marshal/test/test-rankOrder.js b/packages/marshal/test/test-rankOrder.js index 94e6999abd..83a1e0d28a 100644 --- a/packages/marshal/test/test-rankOrder.js +++ b/packages/marshal/test/test-rankOrder.js @@ -1,6 +1,5 @@ // @ts-nocheck -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; // eslint-disable-next-line import/no-extraneous-dependencies import { fc } from '@fast-check/ava'; diff --git a/packages/memoize/test/prepare-test-env-ava.js b/packages/memoize/test/prepare-test-env-ava.js deleted file mode 100644 index f5ed7c0c84..0000000000 --- a/packages/memoize/test/prepare-test-env-ava.js +++ /dev/null @@ -1,9 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import '@endo/init/debug.js'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/memoize/test/test-memoize.js b/packages/memoize/test/test-memoize.js index 8ef5a5010e..8a6c9e688c 100644 --- a/packages/memoize/test/test-memoize.js +++ b/packages/memoize/test/test-memoize.js @@ -1,4 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; + import { memoize } from '../src/memoize.js'; test('memoize', t => { diff --git a/packages/pass-style/test/prepare-test-env-ava.js b/packages/pass-style/test/prepare-test-env-ava.js deleted file mode 100644 index f5ed7c0c84..0000000000 --- a/packages/pass-style/test/prepare-test-env-ava.js +++ /dev/null @@ -1,9 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import '@endo/init/debug.js'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/pass-style/test/test-extended-errors.js b/packages/pass-style/test/test-extended-errors.js index 1f24f4b5e5..11d02b2f79 100644 --- a/packages/pass-style/test/test-extended-errors.js +++ b/packages/pass-style/test/test-extended-errors.js @@ -1,7 +1,6 @@ /* eslint-disable max-classes-per-file */ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { passStyleOf } from '../src/passStyleOf.js'; test('style of extended errors', t => { diff --git a/packages/pass-style/test/test-far-class-instances.js b/packages/pass-style/test/test-far-class-instances.js index 42f6e9ff3d..5af71468b1 100644 --- a/packages/pass-style/test/test-far-class-instances.js +++ b/packages/pass-style/test/test-far-class-instances.js @@ -1,8 +1,7 @@ /* eslint-disable class-methods-use-this */ /* eslint-disable max-classes-per-file */ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { getMethodNames } from '@endo/eventual-send/utils.js'; import { passStyleOf } from '../src/passStyleOf.js'; import { Far, GET_METHOD_NAMES } from '../src/make-far.js'; diff --git a/packages/pass-style/test/test-far-wobbly-point.js b/packages/pass-style/test/test-far-wobbly-point.js index e46060d91c..e297113a4b 100644 --- a/packages/pass-style/test/test-far-wobbly-point.js +++ b/packages/pass-style/test/test-far-wobbly-point.js @@ -5,9 +5,8 @@ /* eslint-disable class-methods-use-this */ /* eslint-disable max-classes-per-file */ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { getMethodNames } from '@endo/eventual-send/utils.js'; import { passStyleOf } from '../src/passStyleOf.js'; import { Far, GET_METHOD_NAMES } from '../src/make-far.js'; diff --git a/packages/pass-style/test/test-message-breakpoints-demo.js b/packages/pass-style/test/test-message-breakpoints-demo.js index 3fc8905331..f4c0e9118c 100644 --- a/packages/pass-style/test/test-message-breakpoints-demo.js +++ b/packages/pass-style/test/test-message-breakpoints-demo.js @@ -1,7 +1,6 @@ import './prepare-breakpoints.js'; -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { E } from '@endo/eventual-send'; import { Far } from '../src/make-far.js'; diff --git a/packages/pass-style/test/test-message-breakpoints.js b/packages/pass-style/test/test-message-breakpoints.js index 00cc794e3c..02dcc2e6b4 100644 --- a/packages/pass-style/test/test-message-breakpoints.js +++ b/packages/pass-style/test/test-message-breakpoints.js @@ -1,6 +1,5 @@ import './prepare-breakpoints.js'; -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { makeMessageBreakpointTester } from '@endo/eventual-send/utils.js'; import { E } from '@endo/eventual-send'; diff --git a/packages/pass-style/test/test-pass-style.js b/packages/pass-style/test/test-pass-style.js deleted file mode 100644 index 9da523a4be..0000000000 --- a/packages/pass-style/test/test-pass-style.js +++ /dev/null @@ -1,5 +0,0 @@ -import { test } from './prepare-test-env-ava.js'; - -test('place holder', async t => { - t.pass(); -}); diff --git a/packages/pass-style/test/test-passStyleOf.js b/packages/pass-style/test/test-passStyleOf.js index 0560223e55..baaa48dd2b 100644 --- a/packages/pass-style/test/test-passStyleOf.js +++ b/packages/pass-style/test/test-passStyleOf.js @@ -1,7 +1,6 @@ /* eslint-disable max-classes-per-file */ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; -// eslint-disable-next-line import/order import { q } from '@endo/errors'; import { passStyleOf } from '../src/passStyleOf.js'; diff --git a/packages/pass-style/test/test-safe-promise.js b/packages/pass-style/test/test-safe-promise.js index 0a7f7f95f5..ce980c39b0 100644 --- a/packages/pass-style/test/test-safe-promise.js +++ b/packages/pass-style/test/test-safe-promise.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { passStyleOf } from '../src/passStyleOf.js'; diff --git a/packages/patterns/test/prepare-test-env-ava.js b/packages/patterns/test/prepare-test-env-ava.js deleted file mode 100644 index f5ed7c0c84..0000000000 --- a/packages/patterns/test/prepare-test-env-ava.js +++ /dev/null @@ -1,9 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import '@endo/init/debug.js'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/patterns/test/test-copyBag.js b/packages/patterns/test/test-copyBag.js index 49dc555084..10cbb438df 100644 --- a/packages/patterns/test/test-copyBag.js +++ b/packages/patterns/test/test-copyBag.js @@ -1,5 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; -// eslint-disable-next-line import/order +import test from '@endo/ses-ava/prepare-endo.js'; + import { makeTagged, getTag, passStyleOf } from '@endo/marshal'; import { isCopyBag, diff --git a/packages/patterns/test/test-copyMap.js b/packages/patterns/test/test-copyMap.js index feb27aa540..c32e130652 100644 --- a/packages/patterns/test/test-copyMap.js +++ b/packages/patterns/test/test-copyMap.js @@ -1,5 +1,4 @@ -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { Fail } from '@endo/errors'; import { makeTagged, getTag, passStyleOf } from '@endo/marshal'; diff --git a/packages/patterns/test/test-copySet.js b/packages/patterns/test/test-copySet.js index 84c4025265..b46e79aa36 100644 --- a/packages/patterns/test/test-copySet.js +++ b/packages/patterns/test/test-copySet.js @@ -1,5 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; -// eslint-disable-next-line import/order +import test from '@endo/ses-ava/prepare-endo.js'; + import { makeTagged, getTag, passStyleOf } from '@endo/marshal'; import { isCopySet, diff --git a/packages/patterns/test/test-pattern-limits.js b/packages/patterns/test/test-pattern-limits.js index e96a6c62b0..363f603a81 100644 --- a/packages/patterns/test/test-pattern-limits.js +++ b/packages/patterns/test/test-pattern-limits.js @@ -1,4 +1,5 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; + import { makeCopyBag, makeCopyMap, makeCopySet } from '../src/keys/checkKey.js'; import { mustMatch, diff --git a/packages/patterns/test/test-patterns.js b/packages/patterns/test/test-patterns.js index 6d032ed736..0a054c9923 100644 --- a/packages/patterns/test/test-patterns.js +++ b/packages/patterns/test/test-patterns.js @@ -1,6 +1,5 @@ /* eslint-disable no-continue */ -// eslint-disable-next-line import/order -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; import { Fail } from '@endo/errors'; import { makeTagged, Far } from '@endo/marshal'; diff --git a/packages/promise-kit/package.json b/packages/promise-kit/package.json index 2ae605a6d8..f59066d073 100644 --- a/packages/promise-kit/package.json +++ b/packages/promise-kit/package.json @@ -41,7 +41,6 @@ "ses": "^1.3.0" }, "devDependencies": { - "@endo/ses-ava": "^1.1.2", "@types/node": "^16.6.0", "ava": "^5.3.0", "babel-eslint": "^10.0.3", diff --git a/packages/promise-kit/test/test-promise-kit.js b/packages/promise-kit/test/test-promise-kit.js index 966b17fca3..b7bbaacf09 100644 --- a/packages/promise-kit/test/test-promise-kit.js +++ b/packages/promise-kit/test/test-promise-kit.js @@ -2,8 +2,7 @@ import 'ses'; import './lockdown.js'; -import rawTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; +import test from 'ava'; import v8 from 'node:v8'; import vm from 'node:vm'; @@ -22,9 +21,6 @@ if (typeof globalThis.gc !== 'function') { engineGC = globalThis.gc; } -/** @type {typeof rawTest} */ -const test = wrapTest(rawTest); - test('makePromiseKit', async t => { const { resolve, promise } = makePromiseKit(); Promise.resolve().then(resolve); diff --git a/packages/ses-ava/NEWS.md b/packages/ses-ava/NEWS.md index c928fd561a..8ab970b1db 100644 --- a/packages/ses-ava/NEWS.md +++ b/packages/ses-ava/NEWS.md @@ -2,6 +2,12 @@ User-visible changes in `@endo/ses-ava`: # Next release +- Rather that writing your own `./prepare-test-env-ava.js` or similar + to setup a ses-ava `test` function, you can now simply + ```js + import test from '@endo/ses-ava/prepare-endo.js'; + ``` + This will set various options appropriately to help you debug your tests. - Ava's `t.log` buffers logged messages, so it can be output later with its test case. But this uses Ava's own console emulation. This loses all the redacted error information printed by SES's `console`. diff --git a/packages/ses-ava/package.json b/packages/ses-ava/package.json index a4c7ae753d..9d76a0adf6 100644 --- a/packages/ses-ava/package.json +++ b/packages/ses-ava/package.json @@ -22,6 +22,7 @@ "exports": { ".": "./index.js", "./exported.js": "./exported.js", + "./prepare-endo.js": "./prepare-endo.js", "./package.json": "./package.json" }, "scripts": { @@ -36,12 +37,12 @@ "test": "ava" }, "dependencies": { + "@endo/env-options": "^1.1.1", + "@endo/init": "^1.0.4", + "ava": "^5.3.0", "ses": "^1.3.0" }, "devDependencies": { - "@endo/env-options": "^1.1.1", - "@endo/lockdown": "^1.0.4", - "ava": "^5.3.0", "babel-eslint": "^10.0.3", "c8": "^7.14.0", "eslint": "^8.46.0", diff --git a/packages/ses-ava/prepare-endo.js b/packages/ses-ava/prepare-endo.js new file mode 100644 index 0000000000..1ff8bca338 --- /dev/null +++ b/packages/ses-ava/prepare-endo.js @@ -0,0 +1,27 @@ +/* global globalThis */ + +import '@endo/init/pre-remoting.js'; +import '@endo/init/debug.js'; +import { environmentOptionsListHas } from '@endo/env-options'; + +import rawTest from 'ava'; +import { wrapTest } from './src/ses-ava-test.js'; + +// TODO consider adding env option setting APIs to @endo/env-options +// TODO should set up globalThis.process.env if absent +const env = (globalThis.process || {}).env || {}; +env.TRACK_TURNS = 'enabled'; + +if (!environmentOptionsListHas('DEBUG', 'track-turns')) { + if ('DEBUG' in env) { + env.DEBUG = `${env.DEBUG},track-turns`; + } else { + env.DEBUG = 'track-turns'; + } +} + +/** @type {typeof rawTest} */ +const test = wrapTest(rawTest); + +// eslint-disable-next-line no-restricted-exports +export { test as default }; diff --git a/packages/ses-ava/test/prepare-test-env-ava.js b/packages/ses-ava/test/prepare-test-env-ava.js deleted file mode 100644 index e83f4928c7..0000000000 --- a/packages/ses-ava/test/prepare-test-env-ava.js +++ /dev/null @@ -1,7 +0,0 @@ -import '@endo/lockdown/commit-debug.js'; - -import rawTest from 'ava'; -import { wrapTest } from '../src/ses-ava-test.js'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/ses-ava/test/test-env-options.js b/packages/ses-ava/test/test-env-options.js index c3379fe38e..dcd6223c05 100644 --- a/packages/ses-ava/test/test-env-options.js +++ b/packages/ses-ava/test/test-env-options.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '../prepare-endo.js'; // eslint-disable-next-line import/order import { makeEnvironmentCaptor } from '@endo/env-options'; diff --git a/packages/ses/test/test-compartment-transforms.js b/packages/ses/test/test-compartment-transforms.js index 78e5287030..38fc5bd234 100644 --- a/packages/ses/test/test-compartment-transforms.js +++ b/packages/ses/test/test-compartment-transforms.js @@ -5,7 +5,6 @@ import { StaticModuleRecord } from '@endo/static-module-record'; import '../index.js'; import './lockdown-safe.js'; // Placing the ava import last demonstrates that ava itself is compatible with SES -// eslint-disable-next-line import/order import test from 'ava'; test('transforms apply to evaluated expressions', t => { diff --git a/packages/skel/test/prepare-test-env-ava.js b/packages/skel/test/prepare-test-env-ava.js deleted file mode 100644 index f5ed7c0c84..0000000000 --- a/packages/skel/test/prepare-test-env-ava.js +++ /dev/null @@ -1,9 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import '@endo/init/debug.js'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import { wrapTest } from '@endo/ses-ava'; -import rawTest from 'ava'; - -/** @type {typeof rawTest} */ -export const test = wrapTest(rawTest); diff --git a/packages/skel/test/test-index.js b/packages/skel/test/test-index.js index f09f5a7be6..bf5a26862c 100644 --- a/packages/skel/test/test-index.js +++ b/packages/skel/test/test-index.js @@ -1,4 +1,4 @@ -import { test } from './prepare-test-env-ava.js'; +import test from '@endo/ses-ava/prepare-endo.js'; test('placeholder', async t => { t.fail('TODO: add tests'); diff --git a/packages/static-module-record/package.json b/packages/static-module-record/package.json index a6ebdca254..fe12eae0c5 100644 --- a/packages/static-module-record/package.json +++ b/packages/static-module-record/package.json @@ -44,7 +44,6 @@ "ses": "^1.3.0" }, "devDependencies": { - "@endo/ses-ava": "^1.1.2", "ava": "^5.3.0", "babel-eslint": "^10.0.3", "benchmark": "^2.1.4", diff --git a/packages/static-module-record/test/test-static-module-record.js b/packages/static-module-record/test/test-static-module-record.js index 21bd72a6fd..0442e53a6e 100644 --- a/packages/static-module-record/test/test-static-module-record.js +++ b/packages/static-module-record/test/test-static-module-record.js @@ -7,10 +7,7 @@ import { StaticModuleRecord } from '../src/static-module-record.js'; import './lockdown.js'; import url from 'url'; import fs from 'fs'; -import avaTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; - -const test = wrapTest(avaTest); +import test from 'ava'; /** @typedef {import('ava').ExecutionContext} TestContext */ diff --git a/packages/stream-node/test/test-stream-node.js b/packages/stream-node/test/test-stream-node.js index 49ad1c95ca..f5e716f3c1 100644 --- a/packages/stream-node/test/test-stream-node.js +++ b/packages/stream-node/test/test-stream-node.js @@ -1,17 +1,11 @@ // @ts-check /* global setTimeout */ - -import '@endo/init/debug.js'; - -import rawTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; +import test from '@endo/ses-ava/prepare-endo.js'; import { fileURLToPath } from 'url'; import { fork } from 'child_process'; import { makeNodeReader, makeNodeWriter } from '../index.js'; -const test = wrapTest(rawTest); - const catPath = fileURLToPath(new URL('cat.js', import.meta.url).toString()); test('stream to and from Node.js reader/writer', async (/** @type {import('ava').ExecutionContext} */ t) => { diff --git a/packages/stream/test/test-map.js b/packages/stream/test/test-map.js index dc3a074ce8..5cf75c1eed 100644 --- a/packages/stream/test/test-map.js +++ b/packages/stream/test/test-map.js @@ -1,13 +1,8 @@ // @ts-check +import test from '@endo/ses-ava/prepare-endo.js'; -import '@endo/init/debug.js'; - -import rawTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; import { mapReader, mapWriter, makePipe } from '../index.js'; -const test = wrapTest(rawTest); - const textEncoder = new TextEncoder(); const textDecoder = new TextDecoder(); diff --git a/packages/stream/test/test-prime.js b/packages/stream/test/test-prime.js index a1f48a7c30..b3a18b7432 100644 --- a/packages/stream/test/test-prime.js +++ b/packages/stream/test/test-prime.js @@ -1,14 +1,9 @@ // @ts-check /* eslint-disable require-yield, no-empty-function */ +import test from '@endo/ses-ava/prepare-endo.js'; -import '@endo/init/debug.js'; - -import rawTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; import { prime } from '../index.js'; -const test = wrapTest(rawTest); - test('prime single next', async (/** @type {import('ava').ExecutionContext} */ t) => { async function* single() { t.is(yield, 0); diff --git a/packages/stream/test/test-pump.js b/packages/stream/test/test-pump.js index 806a0c4457..2693e2d23c 100644 --- a/packages/stream/test/test-pump.js +++ b/packages/stream/test/test-pump.js @@ -1,13 +1,8 @@ // @ts-check +import test from '@endo/ses-ava/prepare-endo.js'; -import '@endo/init/debug.js'; - -import rawTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; import { pump, prime } from '../index.js'; -const test = wrapTest(rawTest); - test('pump happy path', async (/** @type {import('ava').ExecutionContext} */ t) => { t.plan(2); diff --git a/packages/stream/test/test-stream.js b/packages/stream/test/test-stream.js index 1485bdb163..c4edacdab1 100644 --- a/packages/stream/test/test-stream.js +++ b/packages/stream/test/test-stream.js @@ -1,13 +1,8 @@ // @ts-check +import test from '@endo/ses-ava/prepare-endo.js'; -import '@endo/init/debug.js'; - -import rawTest from 'ava'; -import { wrapTest } from '@endo/ses-ava'; import { makePipe } from '../index.js'; -const test = wrapTest(rawTest); - test('stream', async (/** @type {import('ava').Assertions} */ t) => { const [consumeFrom, produceTo] = makePipe();