Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2023-07-13 09:09:17 +00:00
parent 4fad06f438
commit 40a500c743
4168 changed files with 298222 additions and 374905 deletions

View file

@ -1,7 +1,7 @@
"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var reduce = arrayProto.reduce;
const arrayProto = require("@sinonjs/commons").prototypes.array;
const reduce = arrayProto.reduce;
module.exports = function exportAsyncBehaviors(behaviorMethods) {
return reduce(
@ -10,7 +10,10 @@ module.exports = function exportAsyncBehaviors(behaviorMethods) {
// need to avoid creating another async versions of the newly added async methods
if (method.match(/^(callsArg|yields)/) && !method.match(/Async/)) {
acc[`${method}Async`] = function () {
var result = behaviorMethods[method].apply(this, arguments);
const result = behaviorMethods[method].apply(
this,
arguments
);
this.callbackAsync = true;
return result;
};

View file

@ -1,15 +1,15 @@
"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var hasOwnProperty =
const arrayProto = require("@sinonjs/commons").prototypes.array;
const hasOwnProperty =
require("@sinonjs/commons").prototypes.object.hasOwnProperty;
var join = arrayProto.join;
var push = arrayProto.push;
const join = arrayProto.join;
const push = arrayProto.push;
// Adapted from https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
var hasDontEnumBug = (function () {
var obj = {
const hasDontEnumBug = (function () {
const obj = {
constructor: function () {
return "0";
},
@ -42,8 +42,8 @@ var hasDontEnumBug = (function () {
},
};
var result = [];
for (var prop in obj) {
const result = [];
for (const prop in obj) {
if (hasOwnProperty(obj, prop)) {
push(result, obj[prop]());
}
@ -51,8 +51,15 @@ var hasDontEnumBug = (function () {
return join(result, "") !== "0123456789";
})();
/**
*
* @param target
* @param sources
* @param doCopy
* @returns {*} target
*/
function extendCommon(target, sources, doCopy) {
var source, i, prop;
let source, i, prop;
for (i = 0; i < sources.length; i++) {
source = sources[i];
@ -77,12 +84,12 @@ function extendCommon(target, sources, doCopy) {
return target;
}
/** Public: Extend target in place with all (own) properties, except 'name' when [[writable]] is false,
/**
* Public: Extend target in place with all (own) properties, except 'name' when [[writable]] is false,
* from sources in-order. Thus, last source will override properties in previous sources.
*
* @param {object} target - The Object to extend
* @param {object[]} sources - Objects to copy properties from.
*
* @returns {object} the extended target
*/
module.exports = function extend(target, ...sources) {
@ -90,11 +97,11 @@ module.exports = function extend(target, ...sources) {
target,
sources,
function copyValue(dest, source, prop) {
var destOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
const destOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
dest,
prop
);
var sourceOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
const sourceOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
source,
prop
);
@ -130,12 +137,12 @@ module.exports = function extend(target, ...sources) {
);
};
/** Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will
/**
* Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will
* override properties in previous sources. Define the properties as non enumerable.
*
* @param {object} target - The Object to extend
* @param {object[]} sources - Objects to copy properties from.
*
* @returns {object} the extended target
*/
module.exports.nonEnum = function extendNonEnum(target, ...sources) {

View file

@ -1,7 +1,7 @@
"use strict";
module.exports = function toString() {
var i, prop, thisValue;
let i, prop, thisValue;
if (this.getCall && this.callCount) {
i = this.callCount;

View file

@ -1,9 +1,9 @@
"use strict";
module.exports = function getPropertyDescriptor(object, property) {
var proto = object;
var descriptor;
var isOwn = Boolean(
let proto = object;
let descriptor;
const isOwn = Boolean(
object && Object.getOwnPropertyDescriptor(object, property)
);

View file

@ -8,7 +8,6 @@
* on weird error messages.
*
* @param {object} object The object to examine
*
* @returns {boolean} true when the object is a module
*/
module.exports = function (object) {

View file

@ -1,9 +1,9 @@
"use strict";
var getPropertyDescriptor = require("./get-property-descriptor");
const getPropertyDescriptor = require("./get-property-descriptor");
function isPropertyConfigurable(obj, propName) {
var propertyDescriptor = getPropertyDescriptor(obj, propName);
const propertyDescriptor = getPropertyDescriptor(obj, propName);
return propertyDescriptor ? propertyDescriptor.configurable : true;
}

View file

@ -1,6 +1,6 @@
"use strict";
var globalObject = require("@sinonjs/commons").global;
var getNextTick = require("./get-next-tick");
const globalObject = require("@sinonjs/commons").global;
const getNextTick = require("./get-next-tick");
module.exports = getNextTick(globalObject.process, globalObject.setImmediate);

22
node_modules/sinon/lib/sinon/util/core/sinon-type.js generated vendored Normal file
View file

@ -0,0 +1,22 @@
"use strict";
const sinonTypeSymbolProperty = Symbol("SinonType");
module.exports = {
/**
* Set the type of a Sinon object to make it possible to identify it later at runtime
*
* @param {object|Function} object object/function to set the type on
* @param {string} type the named type of the object/function
*/
set(object, type) {
Object.defineProperty(object, sinonTypeSymbolProperty, {
value: type,
configurable: false,
enumerable: false,
});
},
get(object) {
return object && object[sinonTypeSymbolProperty];
},
};

View file

@ -1,6 +1,6 @@
"use strict";
var array = [null, "once", "twice", "thrice"];
const array = [null, "once", "twice", "thrice"];
module.exports = function timesInWords(count) {
return array[count] || `${count || 0} times`;

View file

@ -1,6 +1,6 @@
"use strict";
var forEach = Array.prototype.forEach;
const forEach = Array.prototype.forEach;
function usePromiseLibrary(library, fakes) {
if (typeof library === "undefined") {

View file

@ -1,13 +1,21 @@
"use strict";
var functionName = require("@sinonjs/commons").functionName;
const functionName = require("@sinonjs/commons").functionName;
var getPropertyDescriptor = require("./get-property-descriptor");
var walk = require("./walk");
const getPropertyDescriptor = require("./get-property-descriptor");
const walk = require("./walk");
function walkObject(predicate, object, filter) {
var called = false;
var name = functionName(predicate);
/**
* A utility that allows traversing an object, applying mutating functions on the properties
*
* @param {Function} mutator called on each property
* @param {object} object the object we are walking over
* @param {Function} filter a predicate (boolean function) that will decide whether or not to apply the mutator to the current property
* @returns {void} nothing
*/
function walkObject(mutator, object, filter) {
let called = false;
const name = functionName(mutator);
if (!object) {
throw new Error(
@ -26,17 +34,19 @@ function walkObject(predicate, object, filter) {
if (filter) {
if (filter(object, prop)) {
called = true;
predicate(object, prop);
mutator(object, prop);
}
} else {
called = true;
predicate(object, prop);
mutator(object, prop);
}
}
});
if (!called) {
throw new Error(`Expected to ${name} methods on object but found none`);
throw new Error(
`Found no methods on object to which we could apply mutations`
);
}
return object;

View file

@ -1,9 +1,10 @@
"use strict";
var forEach = require("@sinonjs/commons").prototypes.array.forEach;
const forEach = require("@sinonjs/commons").prototypes.array.forEach;
function walkInternal(obj, iterator, context, originalObj, seen) {
var proto, prop;
let prop;
const proto = Object.getPrototypeOf(obj);
if (typeof Object.getOwnPropertyNames !== "function") {
// We explicitly want to enumerate through all of the prototype's properties
@ -19,7 +20,7 @@ function walkInternal(obj, iterator, context, originalObj, seen) {
forEach(Object.getOwnPropertyNames(obj), function (k) {
if (seen[k] !== true) {
seen[k] = true;
var target =
const target =
typeof Object.getOwnPropertyDescriptor(obj, k).get ===
"function"
? originalObj
@ -28,7 +29,6 @@ function walkInternal(obj, iterator, context, originalObj, seen) {
}
});
proto = Object.getPrototypeOf(obj);
if (proto) {
walkInternal(proto, iterator, context, originalObj, seen);
}

View file

@ -1,11 +1,14 @@
"use strict";
var getPropertyDescriptor = require("./get-property-descriptor");
var extend = require("./extend");
var hasOwnProperty =
// eslint-disable-next-line no-empty-function
const noop = () => {};
const getPropertyDescriptor = require("./get-property-descriptor");
const extend = require("./extend");
const sinonType = require("./sinon-type");
const hasOwnProperty =
require("@sinonjs/commons").prototypes.object.hasOwnProperty;
var valueToString = require("@sinonjs/commons").valueToString;
var push = require("@sinonjs/commons").prototypes.array.push;
const valueToString = require("@sinonjs/commons").valueToString;
const push = require("@sinonjs/commons").prototypes.array.push;
function isFunction(obj) {
return (
@ -15,7 +18,7 @@ function isFunction(obj) {
}
function mirrorProperties(target, source) {
for (var prop in source) {
for (const prop in source) {
if (!hasOwnProperty(target, prop)) {
target[prop] = source[prop];
}
@ -23,10 +26,10 @@ function mirrorProperties(target, source) {
}
function getAccessor(object, property, method) {
var accessors = ["get", "set"];
var descriptor = getPropertyDescriptor(object, property);
const accessors = ["get", "set"];
const descriptor = getPropertyDescriptor(object, property);
for (var i = 0; i < accessors.length; i++) {
for (let i = 0; i < accessors.length; i++) {
if (
descriptor[accessors[i]] &&
descriptor[accessors[i]].name === method.name
@ -38,7 +41,7 @@ function getAccessor(object, property, method) {
}
// Cheap way to detect if we have ES5 support.
var hasES5Support = "keys" in Object;
const hasES5Support = "keys" in Object;
module.exports = function wrapMethod(object, property, method) {
if (!object) {
@ -52,7 +55,7 @@ module.exports = function wrapMethod(object, property, method) {
}
function checkWrappedMethod(wrappedMethod) {
var error;
let error;
if (!isFunction(wrappedMethod)) {
error = new TypeError(
@ -67,7 +70,7 @@ module.exports = function wrapMethod(object, property, method) {
)} which is already wrapped`
);
} else if (wrappedMethod.calledBefore) {
var verb = wrappedMethod.returns ? "stubbed" : "spied on";
const verb = wrappedMethod.returns ? "stubbed" : "spied on";
error = new TypeError(
`Attempted to wrap ${valueToString(
property
@ -83,15 +86,9 @@ module.exports = function wrapMethod(object, property, method) {
}
}
var error,
wrappedMethods,
wrappedMethod,
i,
wrappedMethodDesc,
target,
accessor;
let error, wrappedMethod, i, wrappedMethodDesc, target, accessor;
wrappedMethods = [];
const wrappedMethods = [];
function simplePropertyAssignment() {
wrappedMethod = object[property];
@ -101,12 +98,12 @@ module.exports = function wrapMethod(object, property, method) {
}
// Firefox has a problem when using hasOwn.call on objects from other frames.
var owned = object.hasOwnProperty
const owned = object.hasOwnProperty
? object.hasOwnProperty(property) // eslint-disable-line @sinonjs/no-prototype-methods/no-prototype-methods
: hasOwnProperty(object, property);
if (hasES5Support) {
var methodDesc =
const methodDesc =
typeof method === "function" ? { value: method } : method;
wrappedMethodDesc = getPropertyDescriptor(object, property);
@ -129,7 +126,7 @@ module.exports = function wrapMethod(object, property, method) {
throw error;
}
var types = Object.keys(methodDesc);
const types = Object.keys(methodDesc);
for (i = 0; i < types.length; i++) {
wrappedMethod = wrappedMethodDesc[types[i]];
checkWrappedMethod(wrappedMethod);
@ -140,6 +137,13 @@ module.exports = function wrapMethod(object, property, method) {
for (i = 0; i < types.length; i++) {
mirrorProperties(methodDesc[types[i]], wrappedMethodDesc[types[i]]);
}
// you are not allowed to flip the configurable prop on an
// existing descriptor to anything but false (#2514)
if (!owned) {
methodDesc.configurable = true;
}
Object.defineProperty(object, property, methodDesc);
// catch failing assignment
@ -180,7 +184,7 @@ module.exports = function wrapMethod(object, property, method) {
function restore() {
accessor = getAccessor(object, property, this.wrappedMethod);
var descriptor;
let descriptor;
// For prototype properties try to reset by delete first.
// If this fails (ex: localStorage on mobile safari) then force a reset
// via direct assignment.
@ -230,6 +234,11 @@ module.exports = function wrapMethod(object, property, method) {
}
}
}
if (sinonType.get(object) === "stub-instance") {
// this is simply to avoid errors after restoring if something should
// traverse the object in a cleanup phase, ref #2477
object[property] = noop;
}
}
return method;

View file

@ -1,21 +1,31 @@
"use strict";
var extend = require("./core/extend");
var FakeTimers = require("@sinonjs/fake-timers");
var globalObject = require("@sinonjs/commons").global;
const extend = require("./core/extend");
const FakeTimers = require("@sinonjs/fake-timers");
const globalObject = require("@sinonjs/commons").global;
/**
*
* @param config
* @param globalCtx
*/
function createClock(config, globalCtx) {
var FakeTimersCtx = FakeTimers;
let FakeTimersCtx = FakeTimers;
if (globalCtx !== null && typeof globalCtx === "object") {
FakeTimersCtx = FakeTimers.withGlobal(globalCtx);
}
var clock = FakeTimersCtx.install(config);
const clock = FakeTimersCtx.install(config);
clock.restore = clock.uninstall;
return clock;
}
/**
*
* @param obj
* @param globalPropName
*/
function addIfDefined(obj, globalPropName) {
var globalProp = globalObject[globalPropName];
const globalProp = globalObject[globalPropName];
if (typeof globalProp !== "undefined") {
obj[globalPropName] = globalProp;
}
@ -26,11 +36,11 @@ function addIfDefined(obj, globalPropName) {
* @returns {object} Returns a lolex clock instance
*/
exports.useFakeTimers = function (dateOrConfig) {
var hasArguments = typeof dateOrConfig !== "undefined";
var argumentIsDateLike =
const hasArguments = typeof dateOrConfig !== "undefined";
const argumentIsDateLike =
(typeof dateOrConfig === "number" || dateOrConfig instanceof Date) &&
arguments.length === 1;
var argumentIsObject =
const argumentIsObject =
dateOrConfig !== null &&
typeof dateOrConfig === "object" &&
arguments.length === 1;
@ -48,8 +58,8 @@ exports.useFakeTimers = function (dateOrConfig) {
}
if (argumentIsObject) {
var config = extend.nonEnum({}, dateOrConfig);
var globalCtx = config.global;
const config = extend.nonEnum({}, dateOrConfig);
const globalCtx = config.global;
delete config.global;
return createClock(config, globalCtx);
}
@ -65,7 +75,7 @@ exports.clock = {
},
};
var timers = {
const timers = {
setTimeout: setTimeout,
clearTimeout: clearTimeout,
setInterval: setInterval,