mocha 10.6.0 → 10.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/lib/runnable.js +4 -6
- package/lib/utils.js +9 -2
- package/mocha.js +15 -10
- package/mocha.js.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<a href="https://github.com/mochajs/mocha/actions?query=workflow%3ATests+branch%3Amain"><img src="https://github.com/mochajs/mocha/workflows/Tests/badge.svg?branch=main" alt="GitHub Actions Build Status"></a>
|
|
9
9
|
<a href="https://coveralls.io/github/mochajs/mocha"><img src="https://coveralls.io/repos/github/mochajs/mocha/badge.svg" alt="Coverage Status"></a>
|
|
10
|
-
<a href="https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_shield"><img src="https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha.svg?type=shield" alt="FOSSA Status"></a>
|
|
11
10
|
<a href="https://discord.gg/KeDn2uXhER"><img alt="Chat - Discord" src="https://img.shields.io/badge/chat-Discord-5765F2.svg" /></a>
|
|
12
11
|
<a href="https://github.com/mochajs/mocha#sponsors"><img src="https://opencollective.com/mochajs/tiers/sponsors/badge.svg" alt="OpenCollective Sponsors"></a>
|
|
13
12
|
<a href="https://github.com/mochajs/mocha#backers"><img src="https://opencollective.com/mochajs/tiers/backers/badge.svg" alt="OpenCollective Backers"></a>
|
package/lib/runnable.js
CHANGED
|
@@ -20,6 +20,8 @@ var setTimeout = global.setTimeout;
|
|
|
20
20
|
var clearTimeout = global.clearTimeout;
|
|
21
21
|
var toString = Object.prototype.toString;
|
|
22
22
|
|
|
23
|
+
var MAX_TIMEOUT = Math.pow(2, 31) - 1;
|
|
24
|
+
|
|
23
25
|
module.exports = Runnable;
|
|
24
26
|
|
|
25
27
|
/**
|
|
@@ -95,8 +97,7 @@ Runnable.prototype.timeout = function (ms) {
|
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
// Clamp to range
|
|
98
|
-
var
|
|
99
|
-
var range = [0, INT_MAX];
|
|
100
|
+
var range = [0, MAX_TIMEOUT];
|
|
100
101
|
ms = utils.clamp(ms, range);
|
|
101
102
|
|
|
102
103
|
// see #1652 for reasoning
|
|
@@ -233,11 +234,8 @@ Runnable.prototype.clearTimeout = function () {
|
|
|
233
234
|
*/
|
|
234
235
|
Runnable.prototype.resetTimeout = function () {
|
|
235
236
|
var self = this;
|
|
236
|
-
var ms = this.timeout();
|
|
237
|
+
var ms = this.timeout() || MAX_TIMEOUT;
|
|
237
238
|
|
|
238
|
-
if (ms === 0) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
239
|
this.clearTimeout();
|
|
242
240
|
this.timer = setTimeout(function () {
|
|
243
241
|
if (self.timeout() === 0) {
|
package/lib/utils.js
CHANGED
|
@@ -138,7 +138,7 @@ function emptyRepresentation(value, typeHint) {
|
|
|
138
138
|
* canonicalType(global) // 'global'
|
|
139
139
|
* canonicalType(new String('foo') // 'object'
|
|
140
140
|
* canonicalType(async function() {}) // 'asyncfunction'
|
|
141
|
-
* canonicalType(
|
|
141
|
+
* canonicalType(Object.create(null)) // 'null-prototype'
|
|
142
142
|
*/
|
|
143
143
|
var canonicalType = (exports.canonicalType = function canonicalType(value) {
|
|
144
144
|
if (value === undefined) {
|
|
@@ -147,7 +147,10 @@ var canonicalType = (exports.canonicalType = function canonicalType(value) {
|
|
|
147
147
|
return 'null';
|
|
148
148
|
} else if (Buffer.isBuffer(value)) {
|
|
149
149
|
return 'buffer';
|
|
150
|
+
} else if (Object.getPrototypeOf(value) === null) {
|
|
151
|
+
return 'null-prototype';
|
|
150
152
|
}
|
|
153
|
+
|
|
151
154
|
return Object.prototype.toString
|
|
152
155
|
.call(value)
|
|
153
156
|
.replace(/^\[.+\s(.+?)]$/, '$1')
|
|
@@ -213,7 +216,7 @@ exports.type = function type(value) {
|
|
|
213
216
|
exports.stringify = function (value) {
|
|
214
217
|
var typeHint = canonicalType(value);
|
|
215
218
|
|
|
216
|
-
if (!~['object', 'array', 'function'].indexOf(typeHint)) {
|
|
219
|
+
if (!~['object', 'array', 'function', 'null-prototype'].indexOf(typeHint)) {
|
|
217
220
|
if (typeHint === 'buffer') {
|
|
218
221
|
var json = Buffer.prototype.toJSON.call(value);
|
|
219
222
|
// Based on the toJSON result
|
|
@@ -399,8 +402,12 @@ exports.canonicalize = function canonicalize(value, stack, typeHint) {
|
|
|
399
402
|
break;
|
|
400
403
|
}
|
|
401
404
|
/* falls through */
|
|
405
|
+
case 'null-prototype':
|
|
402
406
|
case 'object':
|
|
403
407
|
canonicalizedObj = canonicalizedObj || {};
|
|
408
|
+
if (typeHint === 'null-prototype' && Symbol.toStringTag in value) {
|
|
409
|
+
canonicalizedObj['[Symbol.toStringTag]'] = value[Symbol.toStringTag];
|
|
410
|
+
}
|
|
404
411
|
withStack(value, function () {
|
|
405
412
|
Object.keys(value)
|
|
406
413
|
.sort()
|
package/mocha.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// mocha@10.6.
|
|
1
|
+
// mocha@10.6.1 in javascript ES2018
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -11101,7 +11101,7 @@
|
|
|
11101
11101
|
* canonicalType(global) // 'global'
|
|
11102
11102
|
* canonicalType(new String('foo') // 'object'
|
|
11103
11103
|
* canonicalType(async function() {}) // 'asyncfunction'
|
|
11104
|
-
* canonicalType(
|
|
11104
|
+
* canonicalType(Object.create(null)) // 'null-prototype'
|
|
11105
11105
|
*/
|
|
11106
11106
|
var canonicalType = (exports.canonicalType = function canonicalType(value) {
|
|
11107
11107
|
if (value === undefined) {
|
|
@@ -11110,7 +11110,10 @@
|
|
|
11110
11110
|
return 'null';
|
|
11111
11111
|
} else if (isBuffer(value)) {
|
|
11112
11112
|
return 'buffer';
|
|
11113
|
+
} else if (Object.getPrototypeOf(value) === null) {
|
|
11114
|
+
return 'null-prototype';
|
|
11113
11115
|
}
|
|
11116
|
+
|
|
11114
11117
|
return Object.prototype.toString
|
|
11115
11118
|
.call(value)
|
|
11116
11119
|
.replace(/^\[.+\s(.+?)]$/, '$1')
|
|
@@ -11176,7 +11179,7 @@
|
|
|
11176
11179
|
exports.stringify = function (value) {
|
|
11177
11180
|
var typeHint = canonicalType(value);
|
|
11178
11181
|
|
|
11179
|
-
if (!~['object', 'array', 'function'].indexOf(typeHint)) {
|
|
11182
|
+
if (!~['object', 'array', 'function', 'null-prototype'].indexOf(typeHint)) {
|
|
11180
11183
|
if (typeHint === 'buffer') {
|
|
11181
11184
|
var json = Buffer.prototype.toJSON.call(value);
|
|
11182
11185
|
// Based on the toJSON result
|
|
@@ -11362,8 +11365,12 @@
|
|
|
11362
11365
|
break;
|
|
11363
11366
|
}
|
|
11364
11367
|
/* falls through */
|
|
11368
|
+
case 'null-prototype':
|
|
11365
11369
|
case 'object':
|
|
11366
11370
|
canonicalizedObj = canonicalizedObj || {};
|
|
11371
|
+
if (typeHint === 'null-prototype' && Symbol.toStringTag in value) {
|
|
11372
|
+
canonicalizedObj['[Symbol.toStringTag]'] = value[Symbol.toStringTag];
|
|
11373
|
+
}
|
|
11367
11374
|
withStack(value, function () {
|
|
11368
11375
|
Object.keys(value)
|
|
11369
11376
|
.sort()
|
|
@@ -12960,6 +12967,8 @@
|
|
|
12960
12967
|
var clearTimeout$1 = commonjsGlobal.clearTimeout;
|
|
12961
12968
|
var toString = Object.prototype.toString;
|
|
12962
12969
|
|
|
12970
|
+
var MAX_TIMEOUT = Math.pow(2, 31) - 1;
|
|
12971
|
+
|
|
12963
12972
|
var runnable = Runnable$3;
|
|
12964
12973
|
|
|
12965
12974
|
/**
|
|
@@ -13035,8 +13044,7 @@
|
|
|
13035
13044
|
}
|
|
13036
13045
|
|
|
13037
13046
|
// Clamp to range
|
|
13038
|
-
var
|
|
13039
|
-
var range = [0, INT_MAX];
|
|
13047
|
+
var range = [0, MAX_TIMEOUT];
|
|
13040
13048
|
ms = utils$2.clamp(ms, range);
|
|
13041
13049
|
|
|
13042
13050
|
// see #1652 for reasoning
|
|
@@ -13173,11 +13181,8 @@
|
|
|
13173
13181
|
*/
|
|
13174
13182
|
Runnable$3.prototype.resetTimeout = function () {
|
|
13175
13183
|
var self = this;
|
|
13176
|
-
var ms = this.timeout();
|
|
13184
|
+
var ms = this.timeout() || MAX_TIMEOUT;
|
|
13177
13185
|
|
|
13178
|
-
if (ms === 0) {
|
|
13179
|
-
return;
|
|
13180
|
-
}
|
|
13181
13186
|
this.clearTimeout();
|
|
13182
13187
|
this.timer = setTimeout$2(function () {
|
|
13183
13188
|
if (self.timeout() === 0) {
|
|
@@ -19169,7 +19174,7 @@
|
|
|
19169
19174
|
};
|
|
19170
19175
|
|
|
19171
19176
|
var name = "mocha";
|
|
19172
|
-
var version = "10.6.
|
|
19177
|
+
var version = "10.6.1";
|
|
19173
19178
|
var homepage = "https://mochajs.org/";
|
|
19174
19179
|
var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
|
|
19175
19180
|
var require$$17 = {
|