Update checked-in dependencies
This commit is contained in:
parent
79817eb679
commit
9c3b394d7f
402 changed files with 12598 additions and 2912 deletions
44
node_modules/sinon/lib/sinon/assert.js
generated
vendored
44
node_modules/sinon/lib/sinon/assert.js
generated
vendored
|
|
@ -52,7 +52,7 @@ function createAssertObject() {
|
|||
|
||||
failAssertion(
|
||||
this,
|
||||
`expected ${expected} to be called in order but were called as ${actual}`
|
||||
`expected ${expected} to be called in order but were called as ${actual}`,
|
||||
);
|
||||
} else {
|
||||
assert.pass("callOrder");
|
||||
|
|
@ -151,7 +151,7 @@ function createAssertObject() {
|
|||
assert.fail(
|
||||
`${assertionMethod} takes 1 argument but was called with ${
|
||||
assertionArgs.length + 1
|
||||
} arguments`
|
||||
} arguments`,
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
|
@ -196,8 +196,8 @@ function createAssertObject() {
|
|||
this,
|
||||
(fake.printf || fake.proxy.printf).apply(
|
||||
fake,
|
||||
concat([msg], args)
|
||||
)
|
||||
concat([msg], args),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
assert.pass(name);
|
||||
|
|
@ -215,79 +215,79 @@ function createAssertObject() {
|
|||
|
||||
mirrorPropAsAssertion(
|
||||
"called",
|
||||
"expected %n to have been called at least once but was never called"
|
||||
"expected %n to have been called at least once but was never called",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"notCalled",
|
||||
function (spy) {
|
||||
return !spy.called;
|
||||
},
|
||||
"expected %n to not have been called but was called %c%C"
|
||||
"expected %n to not have been called but was called %c%C",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"calledOnce",
|
||||
"expected %n to be called once but was called %c%C"
|
||||
"expected %n to be called once but was called %c%C",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"calledTwice",
|
||||
"expected %n to be called twice but was called %c%C"
|
||||
"expected %n to be called twice but was called %c%C",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"calledThrice",
|
||||
"expected %n to be called thrice but was called %c%C"
|
||||
"expected %n to be called thrice but was called %c%C",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"calledOn",
|
||||
"expected %n to be called with %1 as this but was called with %t"
|
||||
"expected %n to be called with %1 as this but was called with %t",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"alwaysCalledOn",
|
||||
"expected %n to always be called with %1 as this but was called with %t"
|
||||
"expected %n to always be called with %1 as this but was called with %t",
|
||||
);
|
||||
mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new");
|
||||
mirrorPropAsAssertion(
|
||||
"alwaysCalledWithNew",
|
||||
"expected %n to always be called with new"
|
||||
"expected %n to always be called with new",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"calledWith",
|
||||
"expected %n to be called with arguments %D"
|
||||
"expected %n to be called with arguments %D",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"calledWithMatch",
|
||||
"expected %n to be called with match %D"
|
||||
"expected %n to be called with match %D",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"alwaysCalledWith",
|
||||
"expected %n to always be called with arguments %D"
|
||||
"expected %n to always be called with arguments %D",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"alwaysCalledWithMatch",
|
||||
"expected %n to always be called with match %D"
|
||||
"expected %n to always be called with match %D",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"calledWithExactly",
|
||||
"expected %n to be called with exact arguments %D"
|
||||
"expected %n to be called with exact arguments %D",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"calledOnceWithExactly",
|
||||
"expected %n to be called once and with exact arguments %D"
|
||||
"expected %n to be called once and with exact arguments %D",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"calledOnceWithMatch",
|
||||
"expected %n to be called once and with match %D"
|
||||
"expected %n to be called once and with match %D",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"alwaysCalledWithExactly",
|
||||
"expected %n to always be called with exact arguments %D"
|
||||
"expected %n to always be called with exact arguments %D",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"neverCalledWith",
|
||||
"expected %n to never be called with arguments %*%C"
|
||||
"expected %n to never be called with arguments %*%C",
|
||||
);
|
||||
mirrorPropAsAssertion(
|
||||
"neverCalledWithMatch",
|
||||
"expected %n to never be called with match %*%C"
|
||||
"expected %n to never be called with match %*%C",
|
||||
);
|
||||
mirrorPropAsAssertion("threw", "%n did not throw exception%C");
|
||||
mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C");
|
||||
|
|
|
|||
20
node_modules/sinon/lib/sinon/behavior.js
generated
vendored
20
node_modules/sinon/lib/sinon/behavior.js
generated
vendored
|
|
@ -57,13 +57,13 @@ function getCallbackError(behavior, func, args) {
|
|||
|
||||
if (behavior.callArgProp) {
|
||||
msg = `${functionName(
|
||||
behavior.stub
|
||||
behavior.stub,
|
||||
)} expected to yield to '${valueToString(
|
||||
behavior.callArgProp
|
||||
behavior.callArgProp,
|
||||
)}', but no object with such a property was passed.`;
|
||||
} else {
|
||||
msg = `${functionName(
|
||||
behavior.stub
|
||||
behavior.stub,
|
||||
)} expected to yield, but no callback was passed.`;
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ function ensureArgs(name, behavior, args) {
|
|||
throw new TypeError(
|
||||
`${name} failed: ${index + 1} arguments required but only ${
|
||||
args.length
|
||||
} present`
|
||||
} present`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -105,13 +105,13 @@ function callCallback(behavior, args) {
|
|||
nextTick(function () {
|
||||
func.apply(
|
||||
behavior.callbackContext,
|
||||
behavior.callbackArguments
|
||||
behavior.callbackArguments,
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return func.apply(
|
||||
behavior.callbackContext,
|
||||
behavior.callbackArguments
|
||||
behavior.callbackArguments,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ const proto = {
|
|||
} else if (typeof this.resolveArgAt === "number") {
|
||||
ensureArgs("resolvesArg", this, args);
|
||||
return (this.promiseLibrary || Promise).resolve(
|
||||
args[this.resolveArgAt]
|
||||
args[this.resolveArgAt],
|
||||
);
|
||||
} else if (this.resolveThis) {
|
||||
return (this.promiseLibrary || Promise).resolve(context);
|
||||
|
|
@ -198,7 +198,7 @@ const proto = {
|
|||
// Call the constructor
|
||||
const F = WrappedClass.bind.apply(
|
||||
WrappedClass,
|
||||
concat([null], argsArray)
|
||||
concat([null], argsArray),
|
||||
);
|
||||
return new F();
|
||||
} else if (typeof this.returnValue !== "undefined") {
|
||||
|
|
@ -239,7 +239,7 @@ const proto = {
|
|||
throw new Error(
|
||||
'Defining a stub by invoking "stub.onCall(...).withArgs(...)" ' +
|
||||
'is not supported. Use "stub.withArgs(...).onCall(...)" ' +
|
||||
"to define sequential behavior for calls with certain arguments."
|
||||
"to define sequential behavior for calls with certain arguments.",
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
@ -249,7 +249,7 @@ function createBehavior(behaviorMethod) {
|
|||
this.defaultBehavior = this.defaultBehavior || proto.create(this);
|
||||
this.defaultBehavior[behaviorMethod].apply(
|
||||
this.defaultBehavior,
|
||||
arguments
|
||||
arguments,
|
||||
);
|
||||
return this;
|
||||
};
|
||||
|
|
|
|||
46
node_modules/sinon/lib/sinon/color.js
generated
vendored
46
node_modules/sinon/lib/sinon/color.js
generated
vendored
|
|
@ -1,31 +1,35 @@
|
|||
"use strict";
|
||||
|
||||
const supportsColor = require("supports-color");
|
||||
|
||||
function colorize(str, color) {
|
||||
if (supportsColor.stdout === false) {
|
||||
return str;
|
||||
module.exports = class Colorizer {
|
||||
constructor(supportsColor = require("supports-color")) {
|
||||
this.supportsColor = supportsColor;
|
||||
}
|
||||
|
||||
return `\x1b[${color}m${str}\x1b[0m`;
|
||||
}
|
||||
colorize(str, color) {
|
||||
if (this.supportsColor.stdout === false) {
|
||||
return str;
|
||||
}
|
||||
|
||||
exports.red = function (str) {
|
||||
return colorize(str, 31);
|
||||
};
|
||||
return `\x1b[${color}m${str}\x1b[0m`;
|
||||
}
|
||||
|
||||
exports.green = function (str) {
|
||||
return colorize(str, 32);
|
||||
};
|
||||
red(str) {
|
||||
return this.colorize(str, 31);
|
||||
}
|
||||
|
||||
exports.cyan = function (str) {
|
||||
return colorize(str, 96);
|
||||
};
|
||||
green(str) {
|
||||
return this.colorize(str, 32);
|
||||
}
|
||||
|
||||
exports.white = function (str) {
|
||||
return colorize(str, 39);
|
||||
};
|
||||
cyan(str) {
|
||||
return this.colorize(str, 96);
|
||||
}
|
||||
|
||||
exports.bold = function (str) {
|
||||
return colorize(str, 1);
|
||||
white(str) {
|
||||
return this.colorize(str, 39);
|
||||
}
|
||||
|
||||
bold(str) {
|
||||
return this.colorize(str, 1);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
2
node_modules/sinon/lib/sinon/create-stub-instance.js
generated
vendored
2
node_modules/sinon/lib/sinon/create-stub-instance.js
generated
vendored
|
|
@ -28,7 +28,7 @@ module.exports = function createStubInstance(constructor, overrides) {
|
|||
}
|
||||
} else {
|
||||
throw new Error(
|
||||
`Cannot stub ${propertyName}. Property does not exist!`
|
||||
`Cannot stub ${propertyName}. Property does not exist!`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
8
node_modules/sinon/lib/sinon/default-behaviors.js
generated
vendored
8
node_modules/sinon/lib/sinon/default-behaviors.js
generated
vendored
|
|
@ -16,7 +16,7 @@ function throwsException(fake, error, message) {
|
|||
} else if (typeof error === "string") {
|
||||
fake.exceptionCreator = function () {
|
||||
const newException = new Error(
|
||||
message || `Sinon-provided ${error}`
|
||||
message || `Sinon-provided ${error}`,
|
||||
);
|
||||
newException.name = error;
|
||||
return newException;
|
||||
|
|
@ -241,7 +241,7 @@ const defaultBehaviors = {
|
|||
get: getterFunction,
|
||||
configurable: isPropertyConfigurable(
|
||||
rootStub.rootObj,
|
||||
rootStub.propName
|
||||
rootStub.propName,
|
||||
),
|
||||
});
|
||||
|
||||
|
|
@ -259,9 +259,9 @@ const defaultBehaviors = {
|
|||
set: setterFunction,
|
||||
configurable: isPropertyConfigurable(
|
||||
rootStub.rootObj,
|
||||
rootStub.propName
|
||||
rootStub.propName,
|
||||
),
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return fake;
|
||||
|
|
|
|||
30
node_modules/sinon/lib/sinon/mock-expectation.js
generated
vendored
30
node_modules/sinon/lib/sinon/mock-expectation.js
generated
vendored
|
|
@ -148,15 +148,15 @@ const mockExpectation = {
|
|||
if (receivedMaxCalls(this)) {
|
||||
this.failed = true;
|
||||
mockExpectation.fail(
|
||||
`${this.method} already called ${timesInWords(this.maxCalls)}`
|
||||
`${this.method} already called ${timesInWords(this.maxCalls)}`,
|
||||
);
|
||||
}
|
||||
|
||||
if ("expectedThis" in this && this.expectedThis !== thisValue) {
|
||||
mockExpectation.fail(
|
||||
`${this.method} called with ${valueToString(
|
||||
thisValue
|
||||
)} as thisValue, expected ${valueToString(this.expectedThis)}`
|
||||
thisValue,
|
||||
)} as thisValue, expected ${valueToString(this.expectedThis)}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -167,16 +167,16 @@ const mockExpectation = {
|
|||
if (!args) {
|
||||
mockExpectation.fail(
|
||||
`${this.method} received no arguments, expected ${inspect(
|
||||
expectedArguments
|
||||
)}`
|
||||
expectedArguments,
|
||||
)}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (args.length < expectedArguments.length) {
|
||||
mockExpectation.fail(
|
||||
`${this.method} received too few arguments (${inspect(
|
||||
args
|
||||
)}), expected ${inspect(expectedArguments)}`
|
||||
args,
|
||||
)}), expected ${inspect(expectedArguments)}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -186,8 +186,8 @@ const mockExpectation = {
|
|||
) {
|
||||
mockExpectation.fail(
|
||||
`${this.method} received too many arguments (${inspect(
|
||||
args
|
||||
)}), expected ${inspect(expectedArguments)}`
|
||||
args,
|
||||
)}), expected ${inspect(expectedArguments)}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -197,20 +197,20 @@ const mockExpectation = {
|
|||
if (!verifyMatcher(expectedArgument, args[i])) {
|
||||
mockExpectation.fail(
|
||||
`${this.method} received wrong arguments ${inspect(
|
||||
args
|
||||
)}, didn't match ${String(expectedArguments)}`
|
||||
args,
|
||||
)}, didn't match ${String(expectedArguments)}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (!deepEqual(args[i], expectedArgument)) {
|
||||
mockExpectation.fail(
|
||||
`${this.method} received wrong arguments ${inspect(
|
||||
args
|
||||
)}, expected ${inspect(expectedArguments)}`
|
||||
args,
|
||||
)}, expected ${inspect(expectedArguments)}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
this
|
||||
this,
|
||||
);
|
||||
},
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ const mockExpectation = {
|
|||
|
||||
const message = `${callStr.replace(
|
||||
", [...",
|
||||
"[, ..."
|
||||
"[, ...",
|
||||
)} ${expectedCallCountInWords(this)}`;
|
||||
|
||||
if (this.met()) {
|
||||
|
|
|
|||
10
node_modules/sinon/lib/sinon/mock.js
generated
vendored
10
node_modules/sinon/lib/sinon/mock.js
generated
vendored
|
|
@ -143,9 +143,9 @@ extend(mock, {
|
|||
return arrayEquals(
|
||||
expectedArgs,
|
||||
currentArgs,
|
||||
expectation.expectsExactArgCount
|
||||
expectation.expectsExactArgCount,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const expectationsToApply = filter(
|
||||
|
|
@ -155,7 +155,7 @@ extend(mock, {
|
|||
!expectation.met() &&
|
||||
expectation.allowsCall(thisValue, args)
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (expectationsToApply.length > 0) {
|
||||
|
|
@ -186,7 +186,7 @@ extend(mock, {
|
|||
`Unexpected call: ${proxyCallToString.call({
|
||||
proxy: method,
|
||||
args: args,
|
||||
})}`
|
||||
})}`,
|
||||
);
|
||||
|
||||
const err = new Error();
|
||||
|
|
@ -204,7 +204,7 @@ extend(mock, {
|
|||
proxy: method,
|
||||
args: args,
|
||||
stack: err.stack,
|
||||
})}`
|
||||
})}`,
|
||||
);
|
||||
|
||||
mockExpectation.fail(join(messages, "\n"));
|
||||
|
|
|
|||
4
node_modules/sinon/lib/sinon/proxy-call-util.js
generated
vendored
4
node_modules/sinon/lib/sinon/proxy-call-util.js
generated
vendored
|
|
@ -25,7 +25,7 @@ exports.delegateToCalls = function delegateToCalls(
|
|||
actual,
|
||||
returnsValues,
|
||||
notCalled,
|
||||
totalCallCount
|
||||
totalCallCount,
|
||||
) {
|
||||
proxy[method] = function () {
|
||||
if (!this.called) {
|
||||
|
|
@ -47,7 +47,7 @@ exports.delegateToCalls = function delegateToCalls(
|
|||
currentCall = this.getCall(i);
|
||||
const returnValue = currentCall[actual || method].apply(
|
||||
currentCall,
|
||||
arguments
|
||||
arguments,
|
||||
);
|
||||
push(returnValues, returnValue);
|
||||
if (returnValue) {
|
||||
|
|
|
|||
24
node_modules/sinon/lib/sinon/proxy-call.js
generated
vendored
24
node_modules/sinon/lib/sinon/proxy-call.js
generated
vendored
|
|
@ -48,7 +48,7 @@ const callProto = {
|
|||
function (prev, arg, i) {
|
||||
return prev && deepEqual(self.args[i], arg);
|
||||
},
|
||||
true
|
||||
true,
|
||||
);
|
||||
},
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ const callProto = {
|
|||
|
||||
return prev && match(expectation).test(actual);
|
||||
},
|
||||
true
|
||||
true,
|
||||
);
|
||||
},
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ const callProto = {
|
|||
callArgWith: function (pos) {
|
||||
return this.callArgOnWith.apply(
|
||||
this,
|
||||
concat([pos, null], slice(arguments, 1))
|
||||
concat([pos, null], slice(arguments, 1)),
|
||||
);
|
||||
},
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ const callProto = {
|
|||
throwArg: function (pos) {
|
||||
if (pos > this.args.length) {
|
||||
throw new TypeError(
|
||||
`Not enough arguments: ${pos} required but only ${this.args.length} present`
|
||||
`Not enough arguments: ${pos} required but only ${this.args.length} present`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ const callProto = {
|
|||
throwYieldError(
|
||||
this.proxy,
|
||||
" cannot yield since no callback was passed.",
|
||||
args
|
||||
args,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ const callProto = {
|
|||
yieldTo: function (prop) {
|
||||
return this.yieldToOn.apply(
|
||||
this,
|
||||
concat([prop, null], slice(arguments, 1))
|
||||
concat([prop, null], slice(arguments, 1)),
|
||||
);
|
||||
},
|
||||
|
||||
|
|
@ -190,9 +190,9 @@ const callProto = {
|
|||
throwYieldError(
|
||||
this.proxy,
|
||||
` cannot yield to '${valueToString(
|
||||
prop
|
||||
prop,
|
||||
)}' since no callback was passed.`,
|
||||
args
|
||||
args,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ const callProto = {
|
|||
// Skip the first two frames because they will refer to Sinon code
|
||||
callStr += (this.stack.split("\n")[3] || "unknown").replace(
|
||||
/^\s*(?:at\s+|@)?/,
|
||||
" at "
|
||||
" at ",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -238,7 +238,7 @@ const callProto = {
|
|||
if (typeof this.args[pos] !== "function") {
|
||||
throw new TypeError(
|
||||
`Expected argument at position ${pos} to be a Function, but was ${typeof this
|
||||
.args[pos]}`
|
||||
.args[pos]}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
@ -261,6 +261,8 @@ callProto.invokeCallback = callProto.yield;
|
|||
* @param exception
|
||||
* @param id
|
||||
* @param errorWithCallStack
|
||||
*
|
||||
* @returns {object} proxyCall
|
||||
*/
|
||||
function createProxyCall(
|
||||
proxy,
|
||||
|
|
@ -269,7 +271,7 @@ function createProxyCall(
|
|||
returnValue,
|
||||
exception,
|
||||
id,
|
||||
errorWithCallStack
|
||||
errorWithCallStack,
|
||||
) {
|
||||
if (typeof id !== "number") {
|
||||
throw new TypeError("Call id is not a number");
|
||||
|
|
|
|||
2
node_modules/sinon/lib/sinon/proxy-invoke.js
generated
vendored
2
node_modules/sinon/lib/sinon/proxy-invoke.js
generated
vendored
|
|
@ -40,7 +40,7 @@ module.exports = function invoke(func, thisValue, args) {
|
|||
// Call through with `new`
|
||||
returnValue = new (bind.apply(
|
||||
this.func || func,
|
||||
concat([thisValue], args)
|
||||
concat([thisValue], args),
|
||||
))();
|
||||
|
||||
if (
|
||||
|
|
|
|||
18
node_modules/sinon/lib/sinon/proxy.js
generated
vendored
18
node_modules/sinon/lib/sinon/proxy.js
generated
vendored
|
|
@ -57,7 +57,7 @@ const proxyApi = {
|
|||
this.returnValues[i],
|
||||
this.exceptions[i],
|
||||
this.callIds[i],
|
||||
this.errorsWithCallStack[i]
|
||||
this.errorsWithCallStack[i],
|
||||
);
|
||||
},
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ const proxyApi = {
|
|||
if (this.invoking) {
|
||||
const err = new Error(
|
||||
"Cannot reset Sinon function while invoking it. " +
|
||||
"Move the call to .resetHistory outside of the callback."
|
||||
"Move the call to .resetHistory outside of the callback.",
|
||||
);
|
||||
err.name = "InvalidResetException";
|
||||
throw err;
|
||||
|
|
@ -183,7 +183,7 @@ delegateToCalls(
|
|||
"calledWith",
|
||||
false,
|
||||
undefined,
|
||||
1
|
||||
1,
|
||||
);
|
||||
delegateToCalls(proxyApi, "calledWithMatch", true);
|
||||
delegateToCalls(proxyApi, "alwaysCalledWith", false, "calledWith");
|
||||
|
|
@ -196,7 +196,7 @@ delegateToCalls(
|
|||
"calledWithExactly",
|
||||
false,
|
||||
undefined,
|
||||
1
|
||||
1,
|
||||
);
|
||||
delegateToCalls(
|
||||
proxyApi,
|
||||
|
|
@ -205,13 +205,13 @@ delegateToCalls(
|
|||
"calledWithMatch",
|
||||
false,
|
||||
undefined,
|
||||
1
|
||||
1,
|
||||
);
|
||||
delegateToCalls(
|
||||
proxyApi,
|
||||
"alwaysCalledWithExactly",
|
||||
false,
|
||||
"calledWithExactly"
|
||||
"calledWithExactly",
|
||||
);
|
||||
delegateToCalls(
|
||||
proxyApi,
|
||||
|
|
@ -221,7 +221,7 @@ delegateToCalls(
|
|||
false,
|
||||
function () {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
);
|
||||
delegateToCalls(
|
||||
proxyApi,
|
||||
|
|
@ -231,7 +231,7 @@ delegateToCalls(
|
|||
false,
|
||||
function () {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
);
|
||||
delegateToCalls(proxyApi, "threw", true);
|
||||
delegateToCalls(proxyApi, "alwaysThrew", false, "threw");
|
||||
|
|
@ -334,7 +334,7 @@ function wrapFunction(func, originalFunc) {
|
|||
}
|
||||
const nameDescriptor = Object.getOwnPropertyDescriptor(
|
||||
originalFunc,
|
||||
"name"
|
||||
"name",
|
||||
);
|
||||
if (nameDescriptor && nameDescriptor.configurable) {
|
||||
// IE 11 functions don't have a name.
|
||||
|
|
|
|||
34
node_modules/sinon/lib/sinon/sandbox.js
generated
vendored
34
node_modules/sinon/lib/sinon/sandbox.js
generated
vendored
|
|
@ -50,7 +50,7 @@ function verifySameType(object, property, replacement) {
|
|||
throw new TypeError(
|
||||
`Cannot replace ${typeof object[
|
||||
property
|
||||
]} with ${typeof replacement}`
|
||||
]} with ${typeof replacement}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -59,8 +59,8 @@ function checkForValidArguments(descriptor, property, replacement) {
|
|||
if (typeof descriptor === "undefined") {
|
||||
throw new TypeError(
|
||||
`Cannot replace non-existent property ${valueToString(
|
||||
property
|
||||
)}. Perhaps you meant sandbox.define()?`
|
||||
property,
|
||||
)}. Perhaps you meant sandbox.define()?`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ function Sandbox() {
|
|||
) {
|
||||
// eslint-disable-next-line no-console
|
||||
logger.printWarning(
|
||||
"Potential memory leak detected; be sure to call restore() to clean up your sandbox. To suppress this warning, modify the leakThreshold property of your sandbox."
|
||||
"Potential memory leak detected; be sure to call restore() to clean up your sandbox. To suppress this warning, modify the leakThreshold property of your sandbox.",
|
||||
);
|
||||
loggedLeakWarning = true;
|
||||
}
|
||||
|
|
@ -197,7 +197,7 @@ function Sandbox() {
|
|||
sandbox.restore = function restore() {
|
||||
if (arguments.length) {
|
||||
throw new Error(
|
||||
"sandbox.restore() does not take any parameters. Perhaps you meant stub.restore()"
|
||||
"sandbox.restore() does not take any parameters. Perhaps you meant stub.restore()",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -259,7 +259,7 @@ function Sandbox() {
|
|||
fakeRestorer.property === property
|
||||
) {
|
||||
throw new TypeError(
|
||||
`Attempted to replace ${property} which is already replaced`
|
||||
`Attempted to replace ${property} which is already replaced`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
@ -292,7 +292,7 @@ function Sandbox() {
|
|||
sandbox.replace.usingAccessor = function replaceUsingAccessor(
|
||||
object,
|
||||
property,
|
||||
replacement
|
||||
replacement,
|
||||
) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
checkForValidArguments(descriptor, property, replacement);
|
||||
|
|
@ -314,8 +314,8 @@ function Sandbox() {
|
|||
if (descriptor) {
|
||||
throw new TypeError(
|
||||
`Cannot define the already existing property ${valueToString(
|
||||
property
|
||||
)}. Perhaps you meant sandbox.replace()?`
|
||||
property,
|
||||
)}. Perhaps you meant sandbox.replace()?`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -336,21 +336,21 @@ function Sandbox() {
|
|||
sandbox.replaceGetter = function replaceGetter(
|
||||
object,
|
||||
property,
|
||||
replacement
|
||||
replacement,
|
||||
) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
|
||||
if (typeof descriptor === "undefined") {
|
||||
throw new TypeError(
|
||||
`Cannot replace non-existent property ${valueToString(
|
||||
property
|
||||
)}`
|
||||
property,
|
||||
)}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof replacement !== "function") {
|
||||
throw new TypeError(
|
||||
"Expected replacement argument to be a function"
|
||||
"Expected replacement argument to be a function",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -374,21 +374,21 @@ function Sandbox() {
|
|||
sandbox.replaceSetter = function replaceSetter(
|
||||
object,
|
||||
property,
|
||||
replacement
|
||||
replacement,
|
||||
) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
|
||||
if (typeof descriptor === "undefined") {
|
||||
throw new TypeError(
|
||||
`Cannot replace non-existent property ${valueToString(
|
||||
property
|
||||
)}`
|
||||
property,
|
||||
)}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof replacement !== "function") {
|
||||
throw new TypeError(
|
||||
"Expected replacement argument to be a function"
|
||||
"Expected replacement argument to be a function",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
27
node_modules/sinon/lib/sinon/spy-formatters.js
generated
vendored
27
node_modules/sinon/lib/sinon/spy-formatters.js
generated
vendored
|
|
@ -1,7 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
const arrayProto = require("@sinonjs/commons").prototypes.array;
|
||||
const color = require("./color");
|
||||
const Colorizer = require("./color");
|
||||
const color = new Colorizer();
|
||||
const match = require("@sinonjs/samsam").createMatcher;
|
||||
const timesInWords = require("./util/core/times-in-words");
|
||||
const inspect = require("util").inspect;
|
||||
|
|
@ -12,6 +13,14 @@ const map = arrayProto.map;
|
|||
const push = arrayProto.push;
|
||||
const slice = arrayProto.slice;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param matcher
|
||||
* @param calledArg
|
||||
* @param calledArgMessage
|
||||
*
|
||||
* @returns {string} the colored text
|
||||
*/
|
||||
function colorSinonMatchText(matcher, calledArg, calledArgMessage) {
|
||||
let calledArgumentMessage = calledArgMessage;
|
||||
let matcherMessage = matcher.message;
|
||||
|
|
@ -24,6 +33,11 @@ function colorSinonMatchText(matcher, calledArg, calledArgMessage) {
|
|||
return `${calledArgumentMessage} ${matcherMessage}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param diff
|
||||
*
|
||||
* @returns {string} the colored diff
|
||||
*/
|
||||
function colorDiffText(diff) {
|
||||
const objects = map(diff, function (part) {
|
||||
let text = part.value;
|
||||
|
|
@ -40,6 +54,11 @@ function colorDiffText(diff) {
|
|||
return join(objects, "");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
* @returns {string} a quoted string
|
||||
*/
|
||||
function quoteStringValue(value) {
|
||||
if (typeof value === "string") {
|
||||
return JSON.stringify(value);
|
||||
|
|
@ -91,14 +110,14 @@ module.exports = {
|
|||
message += colorSinonMatchText(
|
||||
expectedArg,
|
||||
calledArg,
|
||||
calledArgMessage
|
||||
calledArgMessage,
|
||||
);
|
||||
} else {
|
||||
const expectedArgMessage =
|
||||
j < expectedArgs.length ? inspect(expectedArg) : "";
|
||||
const diff = jsDiff.diffJson(
|
||||
calledArgMessage,
|
||||
expectedArgMessage
|
||||
expectedArgMessage,
|
||||
);
|
||||
message += colorDiffText(diff);
|
||||
}
|
||||
|
|
@ -138,7 +157,7 @@ module.exports = {
|
|||
map(args, function (arg) {
|
||||
return inspect(arg);
|
||||
}),
|
||||
", "
|
||||
", ",
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
|
|||
20
node_modules/sinon/lib/sinon/spy.js
generated
vendored
20
node_modules/sinon/lib/sinon/spy.js
generated
vendored
|
|
@ -81,38 +81,38 @@ const spyApi = {
|
|||
const delegateToCalls = proxyCallUtil.delegateToCalls;
|
||||
delegateToCalls(spyApi, "callArg", false, "callArgWith", true, function () {
|
||||
throw new Error(
|
||||
`${this.toString()} cannot call arg since it was not yet invoked.`
|
||||
`${this.toString()} cannot call arg since it was not yet invoked.`,
|
||||
);
|
||||
});
|
||||
spyApi.callArgWith = spyApi.callArg;
|
||||
delegateToCalls(spyApi, "callArgOn", false, "callArgOnWith", true, function () {
|
||||
throw new Error(
|
||||
`${this.toString()} cannot call arg since it was not yet invoked.`
|
||||
`${this.toString()} cannot call arg since it was not yet invoked.`,
|
||||
);
|
||||
});
|
||||
spyApi.callArgOnWith = spyApi.callArgOn;
|
||||
delegateToCalls(spyApi, "throwArg", false, "throwArg", false, function () {
|
||||
throw new Error(
|
||||
`${this.toString()} cannot throw arg since it was not yet invoked.`
|
||||
`${this.toString()} cannot throw arg since it was not yet invoked.`,
|
||||
);
|
||||
});
|
||||
delegateToCalls(spyApi, "yield", false, "yield", true, function () {
|
||||
throw new Error(
|
||||
`${this.toString()} cannot yield since it was not yet invoked.`
|
||||
`${this.toString()} cannot yield since it was not yet invoked.`,
|
||||
);
|
||||
});
|
||||
// "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode.
|
||||
spyApi.invokeCallback = spyApi.yield;
|
||||
delegateToCalls(spyApi, "yieldOn", false, "yieldOn", true, function () {
|
||||
throw new Error(
|
||||
`${this.toString()} cannot yield since it was not yet invoked.`
|
||||
`${this.toString()} cannot yield since it was not yet invoked.`,
|
||||
);
|
||||
});
|
||||
delegateToCalls(spyApi, "yieldTo", false, "yieldTo", true, function (property) {
|
||||
throw new Error(
|
||||
`${this.toString()} cannot yield to '${valueToString(
|
||||
property
|
||||
)}' since it was not yet invoked.`
|
||||
property,
|
||||
)}' since it was not yet invoked.`,
|
||||
);
|
||||
});
|
||||
delegateToCalls(
|
||||
|
|
@ -124,10 +124,10 @@ delegateToCalls(
|
|||
function (property) {
|
||||
throw new Error(
|
||||
`${this.toString()} cannot yield to '${valueToString(
|
||||
property
|
||||
)}' since it was not yet invoked.`
|
||||
property,
|
||||
)}' since it was not yet invoked.`,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
function createSpy(func) {
|
||||
|
|
|
|||
12
node_modules/sinon/lib/sinon/stub.js
generated
vendored
12
node_modules/sinon/lib/sinon/stub.js
generated
vendored
|
|
@ -39,7 +39,7 @@ function createStub(originalFunc) {
|
|||
return (
|
||||
a.matchingArguments.length - b.matchingArguments.length
|
||||
);
|
||||
})
|
||||
}),
|
||||
) || proxy;
|
||||
return getCurrentBehavior(fnStub).invoke(this, arguments);
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ function createStub(originalFunc) {
|
|||
function stub(object, property) {
|
||||
if (arguments.length > 2) {
|
||||
throw new TypeError(
|
||||
"stub(obj, 'meth', fn) has been removed, see documentation"
|
||||
"stub(obj, 'meth', fn) has been removed, see documentation",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ function stub(object, property) {
|
|||
|
||||
if (isNonExistentProperty(object, property)) {
|
||||
throw new TypeError(
|
||||
`Cannot stub non-existent property ${valueToString(property)}`
|
||||
`Cannot stub non-existent property ${valueToString(property)}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -136,17 +136,17 @@ function assertValidPropertyDescriptor(descriptor, property) {
|
|||
}
|
||||
if (descriptor.isOwn && !descriptor.configurable && !descriptor.writable) {
|
||||
throw new TypeError(
|
||||
`Descriptor for property ${property} is non-configurable and non-writable`
|
||||
`Descriptor for property ${property} is non-configurable and non-writable`,
|
||||
);
|
||||
}
|
||||
if ((descriptor.get || descriptor.set) && !descriptor.configurable) {
|
||||
throw new TypeError(
|
||||
`Descriptor for accessor property ${property} is non-configurable`
|
||||
`Descriptor for accessor property ${property} is non-configurable`,
|
||||
);
|
||||
}
|
||||
if (isDataDescriptor(descriptor) && !descriptor.writable) {
|
||||
throw new TypeError(
|
||||
`Descriptor for data property ${property} is non-writable`
|
||||
`Descriptor for data property ${property} is non-writable`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
node_modules/sinon/lib/sinon/throw-on-falsy-object.js
generated
vendored
2
node_modules/sinon/lib/sinon/throw-on-falsy-object.js
generated
vendored
|
|
@ -5,7 +5,7 @@ function throwOnFalsyObject(object, property) {
|
|||
if (property && !object) {
|
||||
const type = object === null ? "null" : "undefined";
|
||||
throw new Error(
|
||||
`Trying to stub property '${valueToString(property)}' of ${type}`
|
||||
`Trying to stub property '${valueToString(property)}' of ${type}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4
node_modules/sinon/lib/sinon/util/core/export-async-behaviors.js
generated
vendored
4
node_modules/sinon/lib/sinon/util/core/export-async-behaviors.js
generated
vendored
|
|
@ -12,7 +12,7 @@ module.exports = function exportAsyncBehaviors(behaviorMethods) {
|
|||
acc[`${method}Async`] = function () {
|
||||
const result = behaviorMethods[method].apply(
|
||||
this,
|
||||
arguments
|
||||
arguments,
|
||||
);
|
||||
this.callbackAsync = true;
|
||||
return result;
|
||||
|
|
@ -20,6 +20,6 @@ module.exports = function exportAsyncBehaviors(behaviorMethods) {
|
|||
}
|
||||
return acc;
|
||||
},
|
||||
{}
|
||||
{},
|
||||
);
|
||||
};
|
||||
|
|
|
|||
8
node_modules/sinon/lib/sinon/util/core/extend.js
generated
vendored
8
node_modules/sinon/lib/sinon/util/core/extend.js
generated
vendored
|
|
@ -99,11 +99,11 @@ module.exports = function extend(target, ...sources) {
|
|||
function copyValue(dest, source, prop) {
|
||||
const destOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
|
||||
dest,
|
||||
prop
|
||||
prop,
|
||||
);
|
||||
const sourceOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
|
||||
source,
|
||||
prop
|
||||
prop,
|
||||
);
|
||||
|
||||
if (prop === "name" && !destOwnPropertyDescriptor.writable) {
|
||||
|
|
@ -133,7 +133,7 @@ module.exports = function extend(target, ...sources) {
|
|||
}
|
||||
}
|
||||
Object.defineProperty(dest, prop, descriptors);
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -156,6 +156,6 @@ module.exports.nonEnum = function extendNonEnum(target, ...sources) {
|
|||
configurable: true,
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
|
|
|||
2
node_modules/sinon/lib/sinon/util/core/get-property-descriptor.js
generated
vendored
2
node_modules/sinon/lib/sinon/util/core/get-property-descriptor.js
generated
vendored
|
|
@ -26,7 +26,7 @@ function getPropertyDescriptor(object, property) {
|
|||
let proto = object;
|
||||
let descriptor;
|
||||
const isOwn = Boolean(
|
||||
object && Object.getOwnPropertyDescriptor(object, property)
|
||||
object && Object.getOwnPropertyDescriptor(object, property),
|
||||
);
|
||||
|
||||
while (
|
||||
|
|
|
|||
2
node_modules/sinon/lib/sinon/util/core/is-non-existent-property.js
generated
vendored
2
node_modules/sinon/lib/sinon/util/core/is-non-existent-property.js
generated
vendored
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
function isNonExistentProperty(object, property) {
|
||||
return Boolean(
|
||||
object && typeof property !== "undefined" && !(property in object)
|
||||
object && typeof property !== "undefined" && !(property in object),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
4
node_modules/sinon/lib/sinon/util/core/walk-object.js
generated
vendored
4
node_modules/sinon/lib/sinon/util/core/walk-object.js
generated
vendored
|
|
@ -19,7 +19,7 @@ function walkObject(mutator, object, filter) {
|
|||
|
||||
if (!object) {
|
||||
throw new Error(
|
||||
`Trying to ${name} object but received ${String(object)}`
|
||||
`Trying to ${name} object but received ${String(object)}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ function walkObject(mutator, object, filter) {
|
|||
|
||||
if (!called) {
|
||||
throw new Error(
|
||||
`Found no methods on object to which we could apply mutations`
|
||||
`Found no methods on object to which we could apply mutations`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
18
node_modules/sinon/lib/sinon/util/core/wrap-method.js
generated
vendored
18
node_modules/sinon/lib/sinon/util/core/wrap-method.js
generated
vendored
|
|
@ -50,7 +50,7 @@ module.exports = function wrapMethod(object, property, method) {
|
|||
|
||||
if (typeof method !== "function" && typeof method !== "object") {
|
||||
throw new TypeError(
|
||||
"Method wrapper should be a function or a property descriptor"
|
||||
"Method wrapper should be a function or a property descriptor",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -60,21 +60,21 @@ module.exports = function wrapMethod(object, property, method) {
|
|||
if (!isFunction(wrappedMethod)) {
|
||||
error = new TypeError(
|
||||
`Attempted to wrap ${typeof wrappedMethod} property ${valueToString(
|
||||
property
|
||||
)} as function`
|
||||
property,
|
||||
)} as function`,
|
||||
);
|
||||
} else if (wrappedMethod.restore && wrappedMethod.restore.sinon) {
|
||||
error = new TypeError(
|
||||
`Attempted to wrap ${valueToString(
|
||||
property
|
||||
)} which is already wrapped`
|
||||
property,
|
||||
)} which is already wrapped`,
|
||||
);
|
||||
} else if (wrappedMethod.calledBefore) {
|
||||
const verb = wrappedMethod.returns ? "stubbed" : "spied on";
|
||||
error = new TypeError(
|
||||
`Attempted to wrap ${valueToString(
|
||||
property
|
||||
)} which is already ${verb}`
|
||||
property,
|
||||
)} which is already ${verb}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -109,14 +109,14 @@ module.exports = function wrapMethod(object, property, method) {
|
|||
|
||||
if (!wrappedMethodDesc) {
|
||||
error = new TypeError(
|
||||
`Attempted to wrap ${typeof wrappedMethod} property ${property} as function`
|
||||
`Attempted to wrap ${typeof wrappedMethod} property ${property} as function`,
|
||||
);
|
||||
} else if (
|
||||
wrappedMethodDesc.restore &&
|
||||
wrappedMethodDesc.restore.sinon
|
||||
) {
|
||||
error = new TypeError(
|
||||
`Attempted to wrap ${property} which is already wrapped`
|
||||
`Attempted to wrap ${property} which is already wrapped`,
|
||||
);
|
||||
}
|
||||
if (error) {
|
||||
|
|
|
|||
4
node_modules/sinon/lib/sinon/util/fake-timers.js
generated
vendored
4
node_modules/sinon/lib/sinon/util/fake-timers.js
generated
vendored
|
|
@ -8,6 +8,8 @@ const globalObject = require("@sinonjs/commons").global;
|
|||
*
|
||||
* @param config
|
||||
* @param globalCtx
|
||||
*
|
||||
* @returns {object} the clock, after installing it on the global context, if given
|
||||
*/
|
||||
function createClock(config, globalCtx) {
|
||||
let FakeTimersCtx = FakeTimers;
|
||||
|
|
@ -65,7 +67,7 @@ exports.useFakeTimers = function (dateOrConfig) {
|
|||
}
|
||||
|
||||
throw new TypeError(
|
||||
"useFakeTimers expected epoch or config object. See https://github.com/sinonjs/sinon"
|
||||
"useFakeTimers expected epoch or config object. See https://github.com/sinonjs/sinon",
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue