Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2021-07-27 22:26:09 +00:00
parent 3ba511a8f1
commit 1c4c64199f
175 changed files with 13227 additions and 15136 deletions

View file

@ -12,9 +12,7 @@
*/
function assertMethodExists(value, method, name, methodPath) {
if (value[method] === null || value[method] === undefined) {
throw new TypeError(
"Expected " + name + " to have method " + methodPath
);
throw new TypeError(`Expected ${name} to have method ${methodPath}`);
}
}

View file

@ -16,12 +16,7 @@ function assertType(value, type, name) {
var actual = typeOf(value);
if (actual !== type) {
throw new TypeError(
"Expected type of " +
name +
" to be " +
type +
", but was " +
actual
`Expected type of ${name} to be ${type}, but was ${actual}`
);
}
}

View file

@ -1,11 +1,16 @@
"use strict";
var every = require("@sinonjs/commons").prototypes.array.every;
var concat = require("@sinonjs/commons").prototypes.array.concat;
var typeOf = require("@sinonjs/commons").typeOf;
var deepEqualFactory = require("../deep-equal").use;
var isMatcher = require("./is-matcher");
var keys = Object.keys;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
/**
* Matches `actual` with `expectation`
*
@ -21,7 +26,13 @@ function matchObject(actual, expectation, matcher) {
return false;
}
return every(Object.keys(expectation), function(key) {
var expectedKeys = keys(expectation);
/* istanbul ignore else: cannot collect coverage for engine that doesn't support Symbol */
if (typeOf(getOwnPropertySymbols) === "function") {
expectedKeys = concat(expectedKeys, getOwnPropertySymbols(expectation));
}
return every(expectedKeys, function (key) {
var exp = expectation[key];
var act = actual[key];

View file

@ -1,12 +1,12 @@
"use strict";
var matcherPrototype = {
toString: function() {
toString: function () {
return this.message;
}
},
};
matcherPrototype.or = function(valueOrMatcher) {
matcherPrototype.or = function (valueOrMatcher) {
var createMatcher = require("../create-matcher");
var isMatcher = createMatcher.isMatcher;
@ -19,14 +19,14 @@ matcherPrototype.or = function(valueOrMatcher) {
: createMatcher(valueOrMatcher);
var m1 = this;
var or = Object.create(matcherPrototype);
or.test = function(actual) {
or.test = function (actual) {
return m1.test(actual) || m2.test(actual);
};
or.message = m1.message + ".or(" + m2.message + ")";
or.message = `${m1.message}.or(${m2.message})`;
return or;
};
matcherPrototype.and = function(valueOrMatcher) {
matcherPrototype.and = function (valueOrMatcher) {
var createMatcher = require("../create-matcher");
var isMatcher = createMatcher.isMatcher;
@ -39,10 +39,10 @@ matcherPrototype.and = function(valueOrMatcher) {
: createMatcher(valueOrMatcher);
var m1 = this;
var and = Object.create(matcherPrototype);
and.test = function(actual) {
and.test = function (actual) {
return m1.test(actual) && m2.test(actual);
};
and.message = m1.message + ".and(" + m2.message + ")";
and.message = `${m1.message}.and(${m2.message})`;
return and;
};

View file

@ -8,54 +8,54 @@ var valueToString = require("@sinonjs/commons").valueToString;
var matchObject = require("./match-object");
var createTypeMap = function(match) {
var createTypeMap = function (match) {
return {
function: function(m, expectation, message) {
function: function (m, expectation, message) {
m.test = expectation;
m.message = message || "match(" + functionName(expectation) + ")";
m.message = message || `match(${functionName(expectation)})`;
},
number: function(m, expectation) {
m.test = function(actual) {
number: function (m, expectation) {
m.test = function (actual) {
// we need type coercion here
return expectation == actual; // eslint-disable-line eqeqeq
};
},
object: function(m, expectation) {
object: function (m, expectation) {
var array = [];
if (typeof expectation.test === "function") {
m.test = function(actual) {
m.test = function (actual) {
return expectation.test(actual) === true;
};
m.message = "match(" + functionName(expectation.test) + ")";
m.message = `match(${functionName(expectation.test)})`;
return m;
}
array = map(Object.keys(expectation), function(key) {
return key + ": " + valueToString(expectation[key]);
array = map(Object.keys(expectation), function (key) {
return `${key}: ${valueToString(expectation[key])}`;
});
m.test = function(actual) {
m.test = function (actual) {
return matchObject(actual, expectation, match);
};
m.message = "match(" + join(array, ", ") + ")";
m.message = `match(${join(array, ", ")})`;
return m;
},
regexp: function(m, expectation) {
m.test = function(actual) {
regexp: function (m, expectation) {
m.test = function (actual) {
return typeof actual === "string" && expectation.test(actual);
};
},
string: function(m, expectation) {
m.test = function(actual) {
string: function (m, expectation) {
m.test = function (actual) {
return (
typeof actual === "string" &&
stringIndexOf(actual, expectation) !== -1
);
};
m.message = 'match("' + expectation + '")';
}
m.message = `match("${expectation}")`;
},
};
};