Skip to content

Commit

Permalink
chore: Upgrade to ava ^6 (merge #2144)
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal authored Mar 14, 2024
2 parents 26df1f1 + 63a75f7 commit 9dd5e27
Show file tree
Hide file tree
Showing 38 changed files with 450 additions and 270 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@octokit/core": "^3.4.0",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"ava": "^5.3.0",
"ava": "^6.1.2",
"eslint": "^8.46.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-jessie": "^0.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/base64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"test": "ava"
},
"devDependencies": {
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"c8": "^7.14.0",
"eslint": "^8.46.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/bundle-source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"./package.json": "./package.json"
},
"scripts": {
"postinstall": "patch-package",
"build": "exit 0",
"build:types": "tsc --build tsconfig.build.json",
"clean:types": "git clean -f '*.d.ts*'",
Expand Down Expand Up @@ -41,7 +42,7 @@
"devDependencies": {
"@endo/lockdown": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"c8": "^7.14.0",
"execa": "^8.0.1"
},
Expand Down
136 changes: 136 additions & 0 deletions packages/bundle-source/patches/mimic-fn+4.0.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
diff --git a/node_modules/mimic-fn/index.js b/node_modules/mimic-fn/index.js
index bc9ef7d..a075a8e 100644
--- a/node_modules/mimic-fn/index.js
+++ b/node_modules/mimic-fn/index.js
@@ -1,71 +1,89 @@
const copyProperty = (to, from, property, ignoreNonConfigurable) => {
- // `Function#length` should reflect the parameters of `to` not `from` since we keep its body.
- // `Function#prototype` is non-writable and non-configurable so can never be modified.
- if (property === 'length' || property === 'prototype') {
- return;
- }
+ // `Function#length` should reflect the parameters of `to` not `from` since we keep its body.
+ // `Function#prototype` is non-writable and non-configurable so can never be modified.
+ if (property === 'length' || property === 'prototype') {
+ return;
+ }

- // `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.
- if (property === 'arguments' || property === 'caller') {
- return;
- }
+ // `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.
+ if (property === 'arguments' || property === 'caller') {
+ return;
+ }

- const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
- const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);

- if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
- return;
- }
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
+ return;
+ }

- Object.defineProperty(to, property, fromDescriptor);
+ Object.defineProperty(to, property, fromDescriptor);
};

// `Object.defineProperty()` throws if the property exists, is not configurable and either:
// - one its descriptors is changed
// - it is non-writable and its value is changed
const canCopyProperty = function (toDescriptor, fromDescriptor) {
- return toDescriptor === undefined || toDescriptor.configurable || (
- toDescriptor.writable === fromDescriptor.writable &&
- toDescriptor.enumerable === fromDescriptor.enumerable &&
- toDescriptor.configurable === fromDescriptor.configurable &&
- (toDescriptor.writable || toDescriptor.value === fromDescriptor.value)
- );
+ return (
+ toDescriptor === undefined ||
+ toDescriptor.configurable ||
+ (toDescriptor.writable === fromDescriptor.writable &&
+ toDescriptor.enumerable === fromDescriptor.enumerable &&
+ toDescriptor.configurable === fromDescriptor.configurable &&
+ (toDescriptor.writable || toDescriptor.value === fromDescriptor.value))
+ );
};

const changePrototype = (to, from) => {
- const fromPrototype = Object.getPrototypeOf(from);
- if (fromPrototype === Object.getPrototypeOf(to)) {
- return;
- }
+ const fromPrototype = Object.getPrototypeOf(from);
+ if (fromPrototype === Object.getPrototypeOf(to)) {
+ return;
+ }

- Object.setPrototypeOf(to, fromPrototype);
+ Object.setPrototypeOf(to, fromPrototype);
};

-const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;
+const wrappedToString = (withName, fromBody) =>
+ `/* Wrapped ${withName}*/\n${fromBody}`;

-const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');
-const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');
+const toStringDescriptor = Object.getOwnPropertyDescriptor(
+ Function.prototype,
+ 'toString',
+);
+const toStringName = Object.getOwnPropertyDescriptor(
+ Function.prototype.toString,
+ 'name',
+);

// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.
// We use `bind()` instead of a closure for the same reason.
// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.
const changeToString = (to, from, name) => {
- const withName = name === '' ? '' : `with ${name.trim()}() `;
- const newToString = wrappedToString.bind(null, withName, from.toString());
- // Ensure `to.toString.toString` is non-enumerable and has the same `same`
- Object.defineProperty(newToString, 'name', toStringName);
- Object.defineProperty(to, 'toString', {...toStringDescriptor, value: newToString});
+ const withName = name === '' ? '' : `with ${name.trim()}() `;
+ const newToString = wrappedToString.bind(null, withName, from.toString());
+ // Ensure `to.toString.toString` is non-enumerable and has the same `same`
+ Object.defineProperty(newToString, 'name', toStringName);
+ const { writable, configurable } = toStringDescriptor;
+ Object.defineProperty(to, 'toString', {
+ value: newToString,
+ writable,
+ configurable,
+ });
};

-export default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {
- const {name} = to;
+export default function mimicFunction(
+ to,
+ from,
+ { ignoreNonConfigurable = false } = {},
+) {
+ const { name } = to;

- for (const property of Reflect.ownKeys(from)) {
- copyProperty(to, from, property, ignoreNonConfigurable);
- }
+ for (const property of Reflect.ownKeys(from)) {
+ copyProperty(to, from, property, ignoreNonConfigurable);
+ }

- changePrototype(to, from);
- changeToString(to, from, name);
+ changePrototype(to, from);
+ changeToString(to, from, name);

- return to;
+ return to;
}
2 changes: 1 addition & 1 deletion packages/captp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"devDependencies": {
"@endo/init": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"c8": "^7.14.0"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/captp/test/test-trap.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const makeWorkerTests = isHost => async t => {
// Small shared array buffer to test iterator.
const transferBuffer = new SharedArrayBuffer(MIN_TRANSFER_BUFFER_LENGTH);
const worker = new Worker(`${dirname}/worker.js`);
t.teardown(() => worker.terminate());
worker.addListener('error', err => t.fail(err));
worker.postMessage({ type: 'TEST_INIT', transferBuffer, isGuest: isHost });

Expand Down
2 changes: 1 addition & 1 deletion packages/check-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@endo/bundle-source": "^3.1.0",
"@endo/init": "^1.0.4",
"@endo/zip": "^1.0.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"c8": "^7.14.0",
"eslint": "^8.46.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cjs-module-analyzer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"test": "ava"
},
"devDependencies": {
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"c8": "^7.14.0",
"eslint": "^8.46.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"ses": "^1.3.0"
},
"devDependencies": {
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"eslint": "^8.46.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"devDependencies": {
"@endo/lockdown": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"c8": "^7.14.0",
"tsd": "^0.28.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/compartment-mapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"ses": "^1.3.0"
},
"devDependencies": {
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"c8": "^7.14.0",
"eslint": "^8.46.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/daemon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@endo/bundle-source": "^3.1.0",
"@endo/init": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"c8": "^7.14.0",
"eslint": "^8.46.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/env-options/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"test": "exit 0"
},
"devDependencies": {
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"eslint": "^8.46.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"devDependencies": {
"@endo/lockdown": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"c8": "^7.14.0",
"ses0_18_3": "npm:[email protected]",
"tsd": "^0.28.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/evasive-transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@rollup/plugin-node-resolve": "^13.0.0",
"@types/babel__generator": "^7.6.7",
"@types/babel__traverse": "^7.20.4",
"ava": "^5.3.0",
"ava": "^6.1.2",
"c8": "^7.14.0",
"rollup": "^2.79.1",
"tsd": "^0.28.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventual-send/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"devDependencies": {
"@endo/lockdown": "^1.0.4",
"ava": "^5.3.0",
"ava": "^6.1.2",
"c8": "^7.14.0",
"tsd": "^0.28.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/exo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"devDependencies": {
"@endo/init": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"eslint": "^8.46.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/far/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"devDependencies": {
"@endo/init": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"c8": "^7.14.0"
},
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/import-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@endo/bundle-source": "^3.1.0",
"@endo/init": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"c8": "^7.14.0"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/init/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"devDependencies": {
"@endo/compartment-mapper": "^1.1.2",
"ava": "^5.3.0"
"ava": "^6.1.2"
},
"dependencies": {
"@endo/base64": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/lp32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"devDependencies": {
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"c8": "^7.14.0",
"eslint": "^8.46.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/marshal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@endo/lockdown": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"@fast-check/ava": "^1.1.5",
"ava": "^5.3.0",
"ava": "^6.1.2",
"c8": "^7.14.0"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/memoize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"devDependencies": {
"@endo/init": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"eslint": "^8.46.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/nat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"homepage": "https://github.com/endojs/endo#readme",
"devDependencies": {
"@endo/compartment-mapper": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"eslint": "^8.46.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.8.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/netstring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ses": "^1.3.0"
},
"devDependencies": {
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"c8": "^7.14.0",
"eslint": "^8.46.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/pass-style/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"devDependencies": {
"@endo/init": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"eslint": "^8.46.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/patterns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"devDependencies": {
"@endo/init": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"eslint": "^8.46.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/promise-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"devDependencies": {
"@types/node": "^16.6.0",
"ava": "^5.3.0",
"ava": "^6.1.2",
"babel-eslint": "^10.0.3",
"c8": "^7.14.0",
"eslint": "^8.46.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ses-ava/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dependencies": {
"@endo/env-options": "^1.1.1",
"@endo/init": "^1.0.4",
"ava": "^5.3.0",
"ava": "^6.1.2",
"ses": "^1.3.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 9dd5e27

Please sign in to comment.