Skip to content

Commit

Permalink
adopt Ava default file glob (#8653)
Browse files Browse the repository at this point in the history
closes: #8273

## Description

Adds a script to migrate a package's file glob to the Ava defaults. See
script docs and #8273 for motivation. It uses
https://github.com/google/zx because I was banging my head on Bash
options and version inconsistencies.

The main thing to review is whether this change is good. Then the code
in the first commit. The subsequent commits just are the code running
over all the packages. When this PR is approved I'll rebase and re-run
the batch to make all the migration commits anew.

Once this is in SDK, we can do the same in other Agoric repos. 

### Security Considerations

n/a
### Scaling Considerations

n/a
### Documentation Considerations

If anything, less need for documentation because it aligns with how Ava
works by default.

### Testing Considerations

To run the script yourself, ensure,
```
npm install -g zx
```



### Upgrade Considerations

n/a
  • Loading branch information
mergify[bot] authored May 9, 2024
2 parents a8e4f51 + 9b8865f commit 822ab08
Show file tree
Hide file tree
Showing 471 changed files with 241 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ module.exports = {
{
// These tests use EV() instead of E(), which are easy to confuse.
// Help by erroring when E() packages are imported.
files: ['packages/boot/test/**/test-*'],
files: ['packages/boot/test/**/*.test.*'],
rules: {
'no-restricted-imports': [
'error',
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-all-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ jobs:
# END-TEST-BOILERPLATE
- name: yarn test (SwingSet)
if: (success() || failure())
run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/test-[A-Da-d]*.js' | $TEST_COLLECT
run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/[A-Da-d]*' | $TEST_COLLECT
- name: notify on failure
if: failure() && github.event_name != 'pull_request'
uses: ./.github/actions/notify-status
Expand Down Expand Up @@ -540,7 +540,7 @@ jobs:
# END-TEST-BOILERPLATE
- name: yarn test (SwingSet)
if: (success() || failure())
run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/test-[E-Ie-i]*.js' | $TEST_COLLECT
run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/[E-Ie-i]*' | $TEST_COLLECT
- name: yarn test (xsnap-lockdown)
if: (success() || failure())
run: cd packages/xsnap-lockdown && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT
Expand Down Expand Up @@ -591,7 +591,7 @@ jobs:
# END-TEST-BOILERPLATE
- name: yarn test (SwingSet)
if: (success() || failure())
run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/test-[J-Rj-r]*.js' | $TEST_COLLECT
run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/[J-Rj-r]*' | $TEST_COLLECT
- name: notify on failure
if: failure() && github.event_name != 'pull_request'
uses: ./.github/actions/notify-status
Expand Down Expand Up @@ -633,7 +633,7 @@ jobs:

- name: yarn test (SwingSet)
if: (success() || failure())
run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/test-[S-Zs-z0-9]*.js' | $TEST_COLLECT
run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/[S-Zs-z0-9.test]*.js' | $TEST_COLLECT
- name: notify on failure
if: failure() && github.event_name != 'pull_request'
uses: ./.github/actions/notify-status
Expand Down
4 changes: 2 additions & 2 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ yarn build
```sh
cd packages/SwingSet
yarn test test/test-xsnap-store.js --update-snapshots
git add test/snapshots/test-xsnap-store.*
yarn test test/xsnap-store.test.js --update-snapshots
git add test/snapshots/xsnap-store.*
git commit -m 'chore(swingset-vat): Update xsnap store test snapshots'
cd ../..
```
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
},
"ava": {
"files": [
"packages/*/test/**/test-*.ts"
"packages/*/test/**/test-*.*",
"packages/*/test/**/*.test.*"
],
"timeout": "30m"
},
Expand Down
11 changes: 6 additions & 5 deletions packages/ERTP/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test:c8": "c8 $C8_OPTIONS ava",
"test:xs": "yarn test:xs-unit && yarn test:xs-worker",
"test:xs-unit": "ava-xs",
"test:xs-worker": "SWINGSET_WORKER_TYPE=xs-worker ava -c 2 'test/swingsetTests/**/test-*.js'",
"test:xs-worker": "SWINGSET_WORKER_TYPE=xs-worker ava -c 2 test/swingsetTests",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
"lint:eslint": "eslint .",
Expand Down Expand Up @@ -68,14 +68,15 @@
"exclude": [
"swingsetTests",
"# fast-check unsupported",
"test/unitTests/test-amountProperties.js",
"test/unitTests/test-inputValidation.js",
"test/unitTests/test-issuerObj.js"
"test/unitTests/amountProperties.test.js",
"test/unitTests/inputValidation.test.js",
"test/unitTests/issuerObj.test.js"
]
},
"ava": {
"files": [
"test/**/test-*.js"
"test/**/test-*.*",
"test/**/*.test.*"
],
"require": [
"@endo/init/debug.js"
Expand Down
5 changes: 3 additions & 2 deletions packages/SwingSet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build": "exit 0",
"test": "ava",
"test:xs": "SWINGSET_WORKER_TYPE=xs-worker ava",
"test:xs-worker": "ava test/workers/test-worker.js -m 'xsnap vat manager'",
"test:xs-worker": "ava test/workers -m 'xsnap vat manager'",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
"lint:types": "tsc",
Expand Down Expand Up @@ -88,7 +88,8 @@
},
"ava": {
"files": [
"test/**/test-*.js"
"test/**/test-*.*",
"test/**/*.test.*"
],
"require": [
"@endo/init/debug.js"
Expand Down
4 changes: 2 additions & 2 deletions packages/SwingSet/src/kernel/kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ export default function buildKernel(
// basically reverting 1cfbeaa3c925d0f8502edfb313ecb12a1cab5eac
// and then ultimately moved to the kernel in a MUCH diminished form
// (see #5342 and #6650, and testUpgrade in
// {@link ../../test/upgrade/test-upgrade.js}).
// {@link ../../test/upgrade/upgrade.test.js}).
// We hope to eventually add back correct sophisticated logic
// by e.g. having liveslots sweep the database when restoring a vat.

Expand Down Expand Up @@ -1867,7 +1867,7 @@ export default function buildKernel(
);
} else {
// this should only happen during unit tests that are too lazy to
// build a complete kernel: test/bundles/test-bundles-kernel.js
// build a complete kernel: test/bundles/bundles-kernel.test.js
console.log(`installBundle cannot notify, missing vatAdminRootKref`);
}
} finally {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { buildPatterns } from './message-patterns.js';
// This exercises all the patterns in 'message-patterns.js' twice with
// comms vats in the path (a different file runs them all with a
// direct connection). To enable/disable specific tests, run with e.g.
// 'yarn test test/test-message-patterns.js -m "test pattern a72
// 'yarn test test/message-patterns.test.js -m "test pattern a72
// comms"' or '-m "*a72 comms"'

// See message-patterns.js for details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { buildPatterns } from './message-patterns.js';
// vatA/vatB connected directly through the kernel (a different file
// runs them all a second time with comms vats in the path). To
// enable/disable specific tests, run with e.g. 'yarn test
// test/test-message-patterns.js -m "test pattern a72 local"' or '-m
// test/message-patterns.test.js -m "test pattern a72 local"' or '-m
// "*a72 local"'

// See message-patterns.js for details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ test('refcount while queued', async t => {
});

test('local promises are rejected by vat upgrade', async t => {
// TODO: Generalize packages/SwingSet/test/upgrade/test-upgrade.js
// TODO: Generalize packages/SwingSet/test/upgrade/upgrade.test.js
/** @type {SwingSetConfig} */
const config = {
includeDevDependencies: true, // for vat-data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Snapshot report for `test/test-state.js`
# Snapshot report for `test/state.test.js`

The actual snapshot is saved in `test-state.js.snap`.
The actual snapshot is saved in `state.test.js.snap`.

Generated by [AVA](https://avajs.dev).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Snapshot report for `test/test-xsnap-store.js`
# Snapshot report for `test/xsnap-store.test.js`

The actual snapshot is saved in `test-xsnap-store.js.snap`.
The actual snapshot is saved in `xsnap-store.test.js.snap`.

Generated by [AVA](https://avajs.dev).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ test('crankhash - initial state and additions', t => {
t.log(`\
This test fails under maintenance of initial kernel state.
If these changes are expected, run:
yarn test --update-snapshots test/test-state.js
yarn test --update-snapshots test/state.test.js
Then commit the changes in .../snapshots/ path.
`);
});
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ test('XS + SES snapshots are long-term deterministic', async t => {
t.log(`\
This test fails under maintenance of xsnap dependencies.
If these changes are expected, run:
yarn test --update-snapshots test/test-xsnap-store.js
yarn test --update-snapshots test/xsnap-store.test.js
Then commit the changes in .../snapshots/ path.
`);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/tools/dvo-test-harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const extractLog = capdata => stupidM.unserialize(capdata);
// 8 - Collect log messages from the test vat until it sends the `testComplete()` message
// 9 - Call `logCheck` with the sequence of log messages sent during the 'after' phase
//
// The SwingSet test `vo-test-harness/test-dvo-test-harness.js` and the
// The SwingSet test `vo-test-harness/dvo-test-harness.test.js` and the
// accompanying vat definition `vo-test-harness/vat-dvo-test-test.js` form a
// test of the durable VO test harness itself, but can be used as a simple
// example of how to set things up.
Expand Down
3 changes: 2 additions & 1 deletion packages/access-token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
},
"ava": {
"files": [
"test/**/test-*.js"
"test/**/test-*.*",
"test/**/*.test.*"
],
"require": [
"@endo/init/debug.js"
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/agoric-cli/.ava-integration-test.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @jessie-check

export default {
files: ['integration-tests/test-workflow.js'],
files: ['integration-tests/*.test.*'],
timeout: '10m',
workerThreads: false,
};
3 changes: 2 additions & 1 deletion packages/agoric-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
"ava": {
"files": [
"test/**/test-*.js"
"test/**/test-*.*",
"test/**/*.test.*"
],
"timeout": "2m",
"workerThreads": false
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Snapshot report for `test/test-inter-cli.js`
# Snapshot report for `test/inter-cli.test.js`

The actual snapshot is saved in `test-inter-cli.js.snap`.
The actual snapshot is saved in `inter-cli.test.js.snap`.

Generated by [AVA](https://avajs.dev).

Expand Down
4 changes: 4 additions & 0 deletions packages/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"ava": {
"require": [
"@endo/init/debug.js"
],
"files": [
"test/**/test-*.*",
"test/**/*.test.*"
]
},
"repository": {
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion packages/base-zone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
},
"ava": {
"files": [
"test/**/test-*.js"
"test/**/test-*.*",
"test/**/*.test.*"
],
"require": [
"@endo/init/debug.js"
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"ts": "module"
},
"files": [
"test/**/test-*.js",
"test/**/test-*.ts"
"test/**/test-*.*",
"test/**/*.test.*"
],
"nodeArguments": [
"--loader=tsx",
Expand Down
6 changes: 3 additions & 3 deletions packages/boot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"build": "exit 0",
"test": "ava",
"test:xs": "SWINGSET_WORKER_TYPE=xs-worker ava 'test/bootstrapTests/**/test-*.js' 'test/upgrading/**/test-*.js'",
"test:xs": "SWINGSET_WORKER_TYPE=xs-worker ava test/bootstrapTests test/upgrading",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
"lint:types": "tsc",
Expand Down Expand Up @@ -77,8 +77,8 @@
"ts": "module"
},
"files": [
"test/**/test-*.js",
"test/**/test-*.ts"
"test/**/test-*.*",
"test/**/*.test.*"
],
"nodeArguments": [
"--loader=tsx",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/boot/test/bootstrapTests/ibcBridgeMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { M } from '@endo/patterns';
import { makeScalarBigMapStore } from '@agoric/vat-data';
import { makeDurableZone } from '@agoric/zone/durable.js';

// TODO: factor out overlap with packages/vats/test/test-network.js
// TODO: factor out overlap with packages/vats/test/network.test.js
export const makeBridge = (
t,
baggage = makeScalarBigMapStore('baggage', {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Snapshot report for `test/test-boot-config.js`
# Snapshot report for `test/boot-config.test.js`

The actual snapshot is saved in `test-boot-config.js.snap`.
The actual snapshot is saved in `boot-config.test.js.snap`.

Generated by [AVA](https://avajs.dev).

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion packages/builders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
},
"ava": {
"files": [
"test/**/test-*.js"
"test/**/test-*.*",
"test/**/*.test.*"
],
"require": [
"@endo/init/debug.js"
Expand Down
3 changes: 2 additions & 1 deletion packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
},
"ava": {
"files": [
"test/**/test-*.js"
"test/**/test-*.*",
"test/**/*.test.*"
],
"require": [
"@endo/init/debug.js"
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion packages/casting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
},
"ava": {
"files": [
"test/**/test-*.js"
"test/**/test-*.*",
"test/**/*.test.*"
],
"timeout": "20m",
"workerThreads": false
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions packages/casting/test/net-access-fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const { stringify: jq } = JSON;

/**
* @file to regenerate
* 1. set RECORDING=true in test-interpose-net-access.js
* 2. run: yarn test test/test-test-interpose-net-access.js --update-snapshots
* 3. for each map in test-test-interpose-net-access.js.md, copy it and
* 1. set RECORDING=true in interpose-net-access.test.js
* 2. run: yarn test test/interpose-net-access.test.js --update-snapshots
* 3. for each map in interpose-net-access.test.js.md, copy it and
* 4. replace all occurences of => with : and paste as args to Object.fromEntries()
* 5. change RECORDING back to false
*/
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion packages/cosmic-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@
"compile": false
},
"files": [
"test/**/test-*.js"
"test/**/test-*.*",
"test/**/*.test.*"
]
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Snapshot report for `test/test-exports.js`
# Snapshot report for `test/exports.test.js`

The actual snapshot is saved in `test-exports.js.snap`.
The actual snapshot is saved in `exports.test.js.snap`.

Generated by [AVA](https://avajs.dev).

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion packages/cosmic-swingset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
},
"ava": {
"files": [
"test/**/test-*.js"
"test/**/test-*.*",
"test/**/*.test.*"
],
"require": [
"@endo/init/debug.js"
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion packages/create-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
"ava": {
"files": [
"test/**/test-*.js"
"test/**/test-*.*",
"test/**/*.test.*"
],
"timeout": "2m",
"workerThreads": false
Expand Down
File renamed without changes.
Loading

0 comments on commit 822ab08

Please sign in to comment.