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,32 +12,27 @@ function available).
## Predicate functions
### `isArguments(value)`
Returns `true` if `value` is an `arguments` object, `false` otherwise.
### `isNegZero(value)`
Returns `true` if `value` is `-0`.
### `isElement(value)`
Returns `true` if `value` is a DOM element node. Unlike
Underscore.js/lodash, this function will return `false` if `value` is an
*element-like* object, i.e. a regular object with a `nodeType` property that
_element-like_ object, i.e. a regular object with a `nodeType` property that
holds the value `1`.
### `isSet(value)`
Returns `true` if `value` is a [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set).
## Comparison functions
### `identical(x, y)`
Strict equality check according to EcmaScript Harmony's `egal`.
@ -45,26 +40,24 @@ Strict equality check according to EcmaScript Harmony's `egal`.
**From the Harmony wiki:**
> An egal function simply makes available the internal `SameValue` function
from section 9.12 of the ES5 spec. If two values are egal, then they are not
observably distinguishable.
> from section 9.12 of the ES5 spec. If two values are egal, then they are not
> observably distinguishable.
`identical` returns `true` when `===` is `true`, except for `-0` and
`+0`, where it returns `false`. Additionally, it returns `true` when
`NaN` is compared to itself.
### `deepEqual(actual, expectation)`
Deep equal comparison. Two values are "deep equal" if:
* They are identical
* They are both date objects representing the same time
* They are both arrays containing elements that are all deepEqual
* They are objects with the same set of properties, and each property
in `actual` is deepEqual to the corresponding property in `expectation`
* `actual` can have [symbolic properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that are missing from `expectation`
- They are identical
- They are both date objects representing the same time
- They are both arrays containing elements that are all deepEqual
- They are objects with the same set of properties, and each property
in `actual` is deepEqual to the corresponding property in `expectation`
- `actual` can have [symbolic properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that are missing from `expectation`
### Matcher
@ -75,77 +68,62 @@ with these built in matchers:
Matches anything.
#### `sinon.match.defined`
Requires the value to be defined.
#### `sinon.match.truthy`
Requires the value to be truthy.
#### `sinon.match.falsy`
Requires the value to be falsy.
#### `sinon.match.bool`
Requires the value to be a `Boolean`
#### `sinon.match.number`
Requires the value to be a `Number`.
#### `sinon.match.string`
Requires the value to be a `String`.
#### `sinon.match.object`
Requires the value to be an `Object`.
#### `sinon.match.func`
Requires the value to be a `Function`.
#### `sinon.match.array`
Requires the value to be an `Array`.
#### `sinon.match.array.deepEquals(arr)`
Requires an `Array` to be deep equal another one.
#### `sinon.match.array.startsWith(arr)`
Requires an `Array` to start with the same values as another one.
#### `sinon.match.array.endsWith(arr)`
Requires an `Array` to end with the same values as another one.
#### `sinon.match.array.contains(arr)`
Requires an `Array` to contain each one of the values the given array has.
#### `sinon.match.map`
Requires the value to be a `Map`.
#### `sinon.match.map.deepEquals(map)`
Requires a `Map` to be deep equal another one.
@ -154,32 +132,26 @@ Requires a `Map` to be deep equal another one.
Requires a `Map` to contain each one of the items the given map has.
#### `sinon.match.set`
Requires the value to be a `Set`.
#### `sinon.match.set.deepEquals(set)`
Requires a `Set` to be deep equal another one.
#### `sinon.match.set.contains(set)`
Requires a `Set` to contain each one of the items the given set has.
#### `sinon.match.regexp`
Requires the value to be a regular expression.
#### `sinon.match.date`
Requires the value to be a `Date` object.
#### `sinon.match.symbol`
Requires the value to be a `Symbol`.
@ -195,18 +167,17 @@ Requires the value to strictly equal `ref`.
#### `sinon.match.typeOf(type)`
Requires the value to be of the given type, where `type` can be one of
`"undefined"`,
`"null"`,
`"boolean"`,
`"number"`,
`"string"`,
`"object"`,
`"function"`,
`"array"`,
`"regexp"`,
`"date"` or
`"symbol"`.
`"undefined"`,
`"null"`,
`"boolean"`,
`"number"`,
`"string"`,
`"object"`,
`"function"`,
`"array"`,
`"regexp"`,
`"date"` or
`"symbol"`.
#### `sinon.match.instanceOf(type)`
@ -222,24 +193,22 @@ The property might be inherited via the prototype chain. If the optional expecta
Same as `sinon.match.has` but the property must be defined by the value itself. Inherited properties are ignored.
#### `sinon.match.hasNested(propertyPath[, expectation])`
Requires the value to define the given `propertyPath`. Dot (`prop.prop`) and bracket (`prop[0]`) notations are supported as in [Lodash.get](https://lodash.com/docs/4.4.2#get).
The propertyPath might be inherited via the prototype chain. If the optional expectation is given, the value at the propertyPath is deeply compared with the expectation. The expectation can be another matcher.
```javascript
sinon.match.hasNested("a[0].b.c");
// Where actual is something like
var actual = { "a": [{ "b": { "c": 3 } }] };
var actual = { a: [{ b: { c: 3 } }] };
sinon.match.hasNested("a.b.c");
// Where actual is something like
var actual = { "a": { "b": { "c": 3 } } };
var actual = { a: { b: { c: 3 } } };
```
#### `sinon.match.every(matcher)`
@ -274,7 +243,14 @@ function returns `true` if the matcher is a case-insensitive substring of
```javascript
samsam.match("Give me something", "Give"); //true
samsam.match("Give me something", "sumptn"); // false
samsam.match({ toString: function () { return "yeah"; } }, "Yeah!"); // true
samsam.match(
{
toString: function () {
return "yeah";
},
},
"Yeah!"
); // true
```
The last example is not symmetric. When the matcher is a string, the `object`
@ -282,13 +258,11 @@ is coerced to a string - in this case using `toString`. Changing the order of
the arguments would cause the matcher to be an object, in which case different
rules apply (see below).
#### Boolean matcher
Performs a strict (i.e. `===`) match with the object. So, only `true`
matches `true`, and only `false` matches `false`.
#### Regular expression matcher
When the matcher is a regular expression, the function will pass if
@ -298,11 +272,17 @@ any object with a `test` method will be used as a matcher this way.
```javascript
samsam.match("Give me something", /^[a-z\s]$/i); // true
samsam.match("Give me something", /[0-9]/); // false
samsam.match({ toString: function () { return "yeah!"; } }, /yeah/); // true
samsam.match(
{
toString: function () {
return "yeah!";
},
},
/yeah/
); // true
samsam.match(234, /[a-z]/); // false
```
#### Number matcher
When the matcher is a number, the assertion will pass if `object == matcher`.
@ -310,11 +290,17 @@ When the matcher is a number, the assertion will pass if `object == matcher`.
```javascript
samsam.match("123", 123); // true
samsam.match("Give me something", 425); // false
samsam.match({ toString: function () { return "42"; } }, 42); // true
samsam.match(
{
toString: function () {
return "42";
},
},
42
); // true
samsam.match(234, 1234); // false
```
#### Function matcher
When the matcher is a function, it is called with `object` as its only
@ -334,17 +320,21 @@ samsam.match("Give me something", function () {
});
// true
samsam.match({
toString: function () {
return "42";
samsam.match(
{
toString: function () {
return "42";
},
},
function () {
return true;
}
}, function () { return true; });
);
// false
samsam.match(234, function () {});
```
#### Object matcher
As mentioned above, if an object matcher defines a `test` method, `match`
@ -354,32 +344,36 @@ If the matcher does not have a test method, a recursive match is performed. If
all properties of `matcher` matches corresponding properties in `object`,
`match` returns `true`. Note that the object matcher does not care if the
number of properties in the two objects are the same - only if all properties in
the matcher recursively matches ones in `object`.
the matcher recursively matches ones in `object`. If supported, this object matchers
include [symbolic properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol)
in the comparison.
```javascript
// true
samsam.match("123", {
test: function (arg) {
return arg == 123;
}
},
});
// false
samsam.match({}, { prop: 42 });
// true
samsam.match({
name: "Chris",
profession: "Programmer"
}, {
name: "Chris"
});
samsam.match(
{
name: "Chris",
profession: "Programmer",
},
{
name: "Chris",
}
);
// false
samsam.match(234, { name: "Chris" });
```
#### DOM elements
`match` can be very helpful when comparing DOM elements, because it allows
@ -391,6 +385,6 @@ var el = document.getElementById("myEl");
samsam.match(el, {
tagName: "h2",
className: "item",
innerHTML: "Howdy"
innerHTML: "Howdy",
});
```