-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Upgrade to ava ^6 (merge #2144)
- Loading branch information
Showing
38 changed files
with
450 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.