mocha 5.0.3 → 5.1.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/CHANGELOG.md +95 -9
- package/bin/_mocha +10 -1
- package/lib/context.js +4 -2
- package/lib/hook.js +11 -2
- package/lib/interfaces/common.js +2 -0
- package/lib/mocha.js +43 -2
- package/lib/ms.js +5 -1
- package/lib/reporters/base.js +11 -1
- package/lib/reporters/doc.js +7 -1
- package/lib/reporters/dot.js +7 -1
- package/lib/reporters/html.js +7 -1
- package/lib/reporters/json-stream.js +9 -2
- package/lib/reporters/json.js +36 -3
- package/lib/reporters/json.js.orig +128 -0
- package/lib/reporters/landing.js +7 -1
- package/lib/reporters/list.js +7 -1
- package/lib/reporters/markdown.js +7 -1
- package/lib/reporters/min.js +7 -1
- package/lib/reporters/nyan.js +7 -1
- package/lib/reporters/progress.js +7 -1
- package/lib/reporters/spec.js +7 -1
- package/lib/reporters/tap.js +7 -1
- package/lib/reporters/xunit.js +7 -1
- package/lib/runnable.js +31 -11
- package/lib/runner.js +19 -13
- package/lib/suite.js +38 -31
- package/lib/utils.js +53 -0
- package/mocha.js +438 -131
- package/package.json +433 -283
- package/CHANGELOG.md.orig +0 -1736
- package/README.md.orig +0 -132
- package/bin/.eslintrc.yml +0 -3
- package/lib/browser/.eslintrc.yml +0 -4
package/mocha.js
CHANGED
|
@@ -336,7 +336,9 @@ exports.getWindowSize = function getWindowSize () {
|
|
|
336
336
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
337
337
|
},{}],5:[function(require,module,exports){
|
|
338
338
|
'use strict';
|
|
339
|
-
|
|
339
|
+
/**
|
|
340
|
+
* @module Context
|
|
341
|
+
*/
|
|
340
342
|
/**
|
|
341
343
|
* Expose `Context`.
|
|
342
344
|
*/
|
|
@@ -355,7 +357,7 @@ function Context () {}
|
|
|
355
357
|
*
|
|
356
358
|
* @api private
|
|
357
359
|
* @param {Runnable} runnable
|
|
358
|
-
* @return {Context}
|
|
360
|
+
* @return {Context} context
|
|
359
361
|
*/
|
|
360
362
|
Context.prototype.runnable = function (runnable) {
|
|
361
363
|
if (!arguments.length) {
|
|
@@ -437,7 +439,10 @@ Context.prototype.retries = function (n) {
|
|
|
437
439
|
|
|
438
440
|
},{}],6:[function(require,module,exports){
|
|
439
441
|
'use strict';
|
|
440
|
-
|
|
442
|
+
/**
|
|
443
|
+
* @module Hook
|
|
444
|
+
*
|
|
445
|
+
*/
|
|
441
446
|
/**
|
|
442
447
|
* Module dependencies.
|
|
443
448
|
*/
|
|
@@ -452,8 +457,12 @@ var inherits = require('./utils').inherits;
|
|
|
452
457
|
module.exports = Hook;
|
|
453
458
|
|
|
454
459
|
/**
|
|
455
|
-
* Initialize a new `Hook` with the given `title` and callback `fn`.
|
|
460
|
+
* Initialize a new `Hook` with the given `title` and callback `fn`. Derived from
|
|
461
|
+
* `Runnable`.
|
|
456
462
|
*
|
|
463
|
+
* @memberof Mocha
|
|
464
|
+
* @public
|
|
465
|
+
* @class
|
|
457
466
|
* @param {String} title
|
|
458
467
|
* @param {Function} fn
|
|
459
468
|
* @api private
|
|
@@ -471,6 +480,8 @@ inherits(Hook, Runnable);
|
|
|
471
480
|
/**
|
|
472
481
|
* Get or set the test `err`.
|
|
473
482
|
*
|
|
483
|
+
* @memberof Mocha.Hook
|
|
484
|
+
* @public
|
|
474
485
|
* @param {Error} err
|
|
475
486
|
* @return {Error}
|
|
476
487
|
* @api public
|
|
@@ -718,6 +729,8 @@ module.exports = function (suites, context, mocha) {
|
|
|
718
729
|
suites.shift();
|
|
719
730
|
} else if (typeof opts.fn === 'undefined' && !suite.pending) {
|
|
720
731
|
throw new Error('Suite "' + suite.fullTitle() + '" was defined but no callback was supplied. Supply a callback or explicitly skip the suite.');
|
|
732
|
+
} else if (!opts.fn && suite.pending) {
|
|
733
|
+
suites.shift();
|
|
721
734
|
}
|
|
722
735
|
|
|
723
736
|
return suite;
|
|
@@ -1050,7 +1063,10 @@ module.exports = function (suite) {
|
|
|
1050
1063
|
* Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
|
1051
1064
|
* MIT Licensed
|
|
1052
1065
|
*/
|
|
1053
|
-
|
|
1066
|
+
/**
|
|
1067
|
+
* @namespace Mocha
|
|
1068
|
+
* @module Mocha
|
|
1069
|
+
*/
|
|
1054
1070
|
/**
|
|
1055
1071
|
* Module dependencies.
|
|
1056
1072
|
*/
|
|
@@ -1079,11 +1095,25 @@ if (!process.browser) {
|
|
|
1079
1095
|
* Expose internals.
|
|
1080
1096
|
*/
|
|
1081
1097
|
|
|
1098
|
+
/**
|
|
1099
|
+
* @public
|
|
1100
|
+
* @class utils
|
|
1101
|
+
* @memberof Mocha
|
|
1102
|
+
*/
|
|
1082
1103
|
exports.utils = utils;
|
|
1083
1104
|
exports.interfaces = require('./interfaces');
|
|
1105
|
+
/**
|
|
1106
|
+
*
|
|
1107
|
+
* @memberof Mocha
|
|
1108
|
+
* @public
|
|
1109
|
+
*/
|
|
1084
1110
|
exports.reporters = reporters;
|
|
1085
1111
|
exports.Runnable = require('./runnable');
|
|
1086
1112
|
exports.Context = require('./context');
|
|
1113
|
+
/**
|
|
1114
|
+
*
|
|
1115
|
+
* @memberof Mocha
|
|
1116
|
+
*/
|
|
1087
1117
|
exports.Runner = require('./runner');
|
|
1088
1118
|
exports.Suite = require('./suite');
|
|
1089
1119
|
exports.Hook = require('./hook');
|
|
@@ -1116,6 +1146,8 @@ function image (name) {
|
|
|
1116
1146
|
* - `fullTrace` display the full stack-trace on failing
|
|
1117
1147
|
* - `grep` string or regexp to filter tests with
|
|
1118
1148
|
*
|
|
1149
|
+
* @public
|
|
1150
|
+
* @class Mocha
|
|
1119
1151
|
* @param {Object} options
|
|
1120
1152
|
* @api public
|
|
1121
1153
|
*/
|
|
@@ -1151,6 +1183,7 @@ function Mocha (options) {
|
|
|
1151
1183
|
/**
|
|
1152
1184
|
* Enable or disable bailing on the first failure.
|
|
1153
1185
|
*
|
|
1186
|
+
* @public
|
|
1154
1187
|
* @api public
|
|
1155
1188
|
* @param {boolean} [bail]
|
|
1156
1189
|
*/
|
|
@@ -1165,6 +1198,7 @@ Mocha.prototype.bail = function (bail) {
|
|
|
1165
1198
|
/**
|
|
1166
1199
|
* Add test `file`.
|
|
1167
1200
|
*
|
|
1201
|
+
* @public
|
|
1168
1202
|
* @api public
|
|
1169
1203
|
* @param {string} file
|
|
1170
1204
|
*/
|
|
@@ -1176,6 +1210,7 @@ Mocha.prototype.addFile = function (file) {
|
|
|
1176
1210
|
/**
|
|
1177
1211
|
* Set reporter to `reporter`, defaults to "spec".
|
|
1178
1212
|
*
|
|
1213
|
+
* @public
|
|
1179
1214
|
* @param {String|Function} reporter name or constructor
|
|
1180
1215
|
* @param {Object} reporterOptions optional options
|
|
1181
1216
|
* @api public
|
|
@@ -1226,7 +1261,7 @@ Mocha.prototype.reporter = function (reporter, reporterOptions) {
|
|
|
1226
1261
|
|
|
1227
1262
|
/**
|
|
1228
1263
|
* Set test UI `name`, defaults to "bdd".
|
|
1229
|
-
*
|
|
1264
|
+
* @public
|
|
1230
1265
|
* @api public
|
|
1231
1266
|
* @param {string} bdd
|
|
1232
1267
|
*/
|
|
@@ -1305,6 +1340,7 @@ Mocha.prototype._growl = function (runner, reporter) {
|
|
|
1305
1340
|
/**
|
|
1306
1341
|
* Escape string and add it to grep as a regexp.
|
|
1307
1342
|
*
|
|
1343
|
+
* @public
|
|
1308
1344
|
* @api public
|
|
1309
1345
|
* @param str
|
|
1310
1346
|
* @returns {Mocha}
|
|
@@ -1316,6 +1352,7 @@ Mocha.prototype.fgrep = function (str) {
|
|
|
1316
1352
|
/**
|
|
1317
1353
|
* Add regexp to grep, if `re` is a string it is escaped.
|
|
1318
1354
|
*
|
|
1355
|
+
* @public
|
|
1319
1356
|
* @param {RegExp|String} re
|
|
1320
1357
|
* @return {Mocha}
|
|
1321
1358
|
* @api public
|
|
@@ -1335,6 +1372,7 @@ Mocha.prototype.grep = function (re) {
|
|
|
1335
1372
|
/**
|
|
1336
1373
|
* Invert `.grep()` matches.
|
|
1337
1374
|
*
|
|
1375
|
+
* @public
|
|
1338
1376
|
* @return {Mocha}
|
|
1339
1377
|
* @api public
|
|
1340
1378
|
*/
|
|
@@ -1346,6 +1384,7 @@ Mocha.prototype.invert = function () {
|
|
|
1346
1384
|
/**
|
|
1347
1385
|
* Ignore global leaks.
|
|
1348
1386
|
*
|
|
1387
|
+
* @public
|
|
1349
1388
|
* @param {Boolean} ignore
|
|
1350
1389
|
* @return {Mocha}
|
|
1351
1390
|
* @api public
|
|
@@ -1362,6 +1401,7 @@ Mocha.prototype.ignoreLeaks = function (ignore) {
|
|
|
1362
1401
|
*
|
|
1363
1402
|
* @return {Mocha}
|
|
1364
1403
|
* @api public
|
|
1404
|
+
* @public
|
|
1365
1405
|
*/
|
|
1366
1406
|
Mocha.prototype.checkLeaks = function () {
|
|
1367
1407
|
this.options.ignoreLeaks = false;
|
|
@@ -1373,6 +1413,7 @@ Mocha.prototype.checkLeaks = function () {
|
|
|
1373
1413
|
*
|
|
1374
1414
|
* @return {Mocha}
|
|
1375
1415
|
* @api public
|
|
1416
|
+
* @public
|
|
1376
1417
|
*/
|
|
1377
1418
|
Mocha.prototype.fullTrace = function () {
|
|
1378
1419
|
this.options.fullStackTrace = true;
|
|
@@ -1384,6 +1425,7 @@ Mocha.prototype.fullTrace = function () {
|
|
|
1384
1425
|
*
|
|
1385
1426
|
* @return {Mocha}
|
|
1386
1427
|
* @api public
|
|
1428
|
+
* @public
|
|
1387
1429
|
*/
|
|
1388
1430
|
Mocha.prototype.growl = function () {
|
|
1389
1431
|
this.options.growl = true;
|
|
@@ -1396,6 +1438,7 @@ Mocha.prototype.growl = function () {
|
|
|
1396
1438
|
* @param {Array|String} globals
|
|
1397
1439
|
* @return {Mocha}
|
|
1398
1440
|
* @api public
|
|
1441
|
+
* @public
|
|
1399
1442
|
* @param {Array|string} globals
|
|
1400
1443
|
* @return {Mocha}
|
|
1401
1444
|
*/
|
|
@@ -1410,6 +1453,7 @@ Mocha.prototype.globals = function (globals) {
|
|
|
1410
1453
|
* @param {Boolean} colors
|
|
1411
1454
|
* @return {Mocha}
|
|
1412
1455
|
* @api public
|
|
1456
|
+
* @public
|
|
1413
1457
|
* @param {boolean} colors
|
|
1414
1458
|
* @return {Mocha}
|
|
1415
1459
|
*/
|
|
@@ -1426,6 +1470,7 @@ Mocha.prototype.useColors = function (colors) {
|
|
|
1426
1470
|
* @param {Boolean} inlineDiffs
|
|
1427
1471
|
* @return {Mocha}
|
|
1428
1472
|
* @api public
|
|
1473
|
+
* @public
|
|
1429
1474
|
* @param {boolean} inlineDiffs
|
|
1430
1475
|
* @return {Mocha}
|
|
1431
1476
|
*/
|
|
@@ -1440,6 +1485,7 @@ Mocha.prototype.useInlineDiffs = function (inlineDiffs) {
|
|
|
1440
1485
|
* @param {Boolean} hideDiff
|
|
1441
1486
|
* @return {Mocha}
|
|
1442
1487
|
* @api public
|
|
1488
|
+
* @public
|
|
1443
1489
|
* @param {boolean} hideDiff
|
|
1444
1490
|
* @return {Mocha}
|
|
1445
1491
|
*/
|
|
@@ -1454,6 +1500,7 @@ Mocha.prototype.hideDiff = function (hideDiff) {
|
|
|
1454
1500
|
* @param {Number} timeout
|
|
1455
1501
|
* @return {Mocha}
|
|
1456
1502
|
* @api public
|
|
1503
|
+
* @public
|
|
1457
1504
|
* @param {number} timeout
|
|
1458
1505
|
* @return {Mocha}
|
|
1459
1506
|
*/
|
|
@@ -1468,6 +1515,7 @@ Mocha.prototype.timeout = function (timeout) {
|
|
|
1468
1515
|
* @param {Number} retry times
|
|
1469
1516
|
* @return {Mocha}
|
|
1470
1517
|
* @api public
|
|
1518
|
+
* @public
|
|
1471
1519
|
*/
|
|
1472
1520
|
Mocha.prototype.retries = function (n) {
|
|
1473
1521
|
this.suite.retries(n);
|
|
@@ -1480,6 +1528,7 @@ Mocha.prototype.retries = function (n) {
|
|
|
1480
1528
|
* @param {Number} slow
|
|
1481
1529
|
* @return {Mocha}
|
|
1482
1530
|
* @api public
|
|
1531
|
+
* @public
|
|
1483
1532
|
* @param {number} slow
|
|
1484
1533
|
* @return {Mocha}
|
|
1485
1534
|
*/
|
|
@@ -1494,6 +1543,7 @@ Mocha.prototype.slow = function (slow) {
|
|
|
1494
1543
|
* @param {Boolean} enabled
|
|
1495
1544
|
* @return {Mocha}
|
|
1496
1545
|
* @api public
|
|
1546
|
+
* @public
|
|
1497
1547
|
* @param {boolean} enabled
|
|
1498
1548
|
* @return {Mocha}
|
|
1499
1549
|
*/
|
|
@@ -1507,6 +1557,7 @@ Mocha.prototype.enableTimeouts = function (enabled) {
|
|
|
1507
1557
|
*
|
|
1508
1558
|
* @return {Mocha}
|
|
1509
1559
|
* @api public
|
|
1560
|
+
* @public
|
|
1510
1561
|
*/
|
|
1511
1562
|
Mocha.prototype.asyncOnly = function () {
|
|
1512
1563
|
this.options.asyncOnly = true;
|
|
@@ -1517,6 +1568,7 @@ Mocha.prototype.asyncOnly = function () {
|
|
|
1517
1568
|
* Disable syntax highlighting (in browser).
|
|
1518
1569
|
*
|
|
1519
1570
|
* @api public
|
|
1571
|
+
* @public
|
|
1520
1572
|
*/
|
|
1521
1573
|
Mocha.prototype.noHighlighting = function () {
|
|
1522
1574
|
this.options.noHighlighting = true;
|
|
@@ -1528,6 +1580,7 @@ Mocha.prototype.noHighlighting = function () {
|
|
|
1528
1580
|
*
|
|
1529
1581
|
* @return {Mocha}
|
|
1530
1582
|
* @api public
|
|
1583
|
+
* @public
|
|
1531
1584
|
*/
|
|
1532
1585
|
Mocha.prototype.allowUncaught = function () {
|
|
1533
1586
|
this.options.allowUncaught = true;
|
|
@@ -1573,6 +1626,7 @@ Mocha.prototype.forbidPending = function () {
|
|
|
1573
1626
|
* cache first in whichever manner best suits your needs.
|
|
1574
1627
|
*
|
|
1575
1628
|
* @api public
|
|
1629
|
+
* @public
|
|
1576
1630
|
* @param {Function} fn
|
|
1577
1631
|
* @return {Runner}
|
|
1578
1632
|
*/
|
|
@@ -1620,7 +1674,9 @@ Mocha.prototype.run = function (fn) {
|
|
|
1620
1674
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},"/lib")
|
|
1621
1675
|
},{"./context":5,"./hook":6,"./interfaces":10,"./reporters":20,"./runnable":32,"./runner":33,"./suite":34,"./test":35,"./utils":36,"_process":56,"escape-string-regexp":46,"growl":2,"path":40}],14:[function(require,module,exports){
|
|
1622
1676
|
'use strict';
|
|
1623
|
-
|
|
1677
|
+
/**
|
|
1678
|
+
* @module milliseconds
|
|
1679
|
+
*/
|
|
1624
1680
|
/**
|
|
1625
1681
|
* Helpers.
|
|
1626
1682
|
*/
|
|
@@ -1634,6 +1690,8 @@ var y = d * 365.25;
|
|
|
1634
1690
|
/**
|
|
1635
1691
|
* Parse or format the given `val`.
|
|
1636
1692
|
*
|
|
1693
|
+
* @memberof Mocha
|
|
1694
|
+
* @public
|
|
1637
1695
|
* @api public
|
|
1638
1696
|
* @param {string|number} val
|
|
1639
1697
|
* @return {string|number}
|
|
@@ -1731,7 +1789,9 @@ function Pending (message) {
|
|
|
1731
1789
|
},{}],16:[function(require,module,exports){
|
|
1732
1790
|
(function (process,global){
|
|
1733
1791
|
'use strict';
|
|
1734
|
-
|
|
1792
|
+
/**
|
|
1793
|
+
* @module Base
|
|
1794
|
+
*/
|
|
1735
1795
|
/**
|
|
1736
1796
|
* Module dependencies.
|
|
1737
1797
|
*/
|
|
@@ -1917,6 +1977,9 @@ var generateDiff = exports.generateDiff = function (actual, expected) {
|
|
|
1917
1977
|
/**
|
|
1918
1978
|
* Output the given `failures` as a list.
|
|
1919
1979
|
*
|
|
1980
|
+
* @public
|
|
1981
|
+
* @memberof Mocha.reporters.Base
|
|
1982
|
+
* @variation 1
|
|
1920
1983
|
* @param {Array} failures
|
|
1921
1984
|
* @api public
|
|
1922
1985
|
*/
|
|
@@ -1993,6 +2056,9 @@ exports.list = function (failures) {
|
|
|
1993
2056
|
* stats such as test duration, number
|
|
1994
2057
|
* of tests passed / failed etc.
|
|
1995
2058
|
*
|
|
2059
|
+
* @memberof Mocha.reporters
|
|
2060
|
+
* @public
|
|
2061
|
+
* @class
|
|
1996
2062
|
* @param {Runner} runner
|
|
1997
2063
|
* @api public
|
|
1998
2064
|
*/
|
|
@@ -2060,6 +2126,8 @@ function Base (runner) {
|
|
|
2060
2126
|
* Output common epilogue used by many of
|
|
2061
2127
|
* the bundled reporters.
|
|
2062
2128
|
*
|
|
2129
|
+
* @memberof Mocha.reporters.Base
|
|
2130
|
+
* @public
|
|
2063
2131
|
* @api public
|
|
2064
2132
|
*/
|
|
2065
2133
|
Base.prototype.epilogue = function () {
|
|
@@ -2236,7 +2304,9 @@ function sameType (a, b) {
|
|
|
2236
2304
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
2237
2305
|
},{"../ms":14,"../utils":36,"_process":56,"diff":45,"supports-color":40,"tty":4}],17:[function(require,module,exports){
|
|
2238
2306
|
'use strict';
|
|
2239
|
-
|
|
2307
|
+
/**
|
|
2308
|
+
* @module Doc
|
|
2309
|
+
*/
|
|
2240
2310
|
/**
|
|
2241
2311
|
* Module dependencies.
|
|
2242
2312
|
*/
|
|
@@ -2253,6 +2323,10 @@ exports = module.exports = Doc;
|
|
|
2253
2323
|
/**
|
|
2254
2324
|
* Initialize a new `Doc` reporter.
|
|
2255
2325
|
*
|
|
2326
|
+
* @class
|
|
2327
|
+
* @memberof Mocha.reporters
|
|
2328
|
+
* @extends {Base}
|
|
2329
|
+
* @public
|
|
2256
2330
|
* @param {Runner} runner
|
|
2257
2331
|
* @api public
|
|
2258
2332
|
*/
|
|
@@ -2303,7 +2377,9 @@ function Doc (runner) {
|
|
|
2303
2377
|
},{"../utils":36,"./base":16}],18:[function(require,module,exports){
|
|
2304
2378
|
(function (process){
|
|
2305
2379
|
'use strict';
|
|
2306
|
-
|
|
2380
|
+
/**
|
|
2381
|
+
* @module Dot
|
|
2382
|
+
*/
|
|
2307
2383
|
/**
|
|
2308
2384
|
* Module dependencies.
|
|
2309
2385
|
*/
|
|
@@ -2321,6 +2397,10 @@ exports = module.exports = Dot;
|
|
|
2321
2397
|
/**
|
|
2322
2398
|
* Initialize a new `Dot` matrix test reporter.
|
|
2323
2399
|
*
|
|
2400
|
+
* @class
|
|
2401
|
+
* @memberof Mocha.reporters
|
|
2402
|
+
* @extends Mocha.reporters.Base
|
|
2403
|
+
* @public
|
|
2324
2404
|
* @api public
|
|
2325
2405
|
* @param {Runner} runner
|
|
2326
2406
|
*/
|
|
@@ -2377,7 +2457,9 @@ inherits(Dot, Base);
|
|
|
2377
2457
|
'use strict';
|
|
2378
2458
|
|
|
2379
2459
|
/* eslint-env browser */
|
|
2380
|
-
|
|
2460
|
+
/**
|
|
2461
|
+
* @module HTML
|
|
2462
|
+
*/
|
|
2381
2463
|
/**
|
|
2382
2464
|
* Module dependencies.
|
|
2383
2465
|
*/
|
|
@@ -2422,6 +2504,10 @@ var playIcon = '‣';
|
|
|
2422
2504
|
/**
|
|
2423
2505
|
* Initialize a new `HTML` reporter.
|
|
2424
2506
|
*
|
|
2507
|
+
* @public
|
|
2508
|
+
* @class
|
|
2509
|
+
* @memberof Mocha.reporters
|
|
2510
|
+
* @extends Mocha.reporters.Base
|
|
2425
2511
|
* @api public
|
|
2426
2512
|
* @param {Runner} runner
|
|
2427
2513
|
*/
|
|
@@ -2748,7 +2834,9 @@ exports.JSONStream = exports['json-stream'] = require('./json-stream');
|
|
|
2748
2834
|
},{"./base":16,"./doc":17,"./dot":18,"./html":19,"./json":22,"./json-stream":21,"./landing":23,"./list":24,"./markdown":25,"./min":26,"./nyan":27,"./progress":28,"./spec":29,"./tap":30,"./xunit":31}],21:[function(require,module,exports){
|
|
2749
2835
|
(function (process){
|
|
2750
2836
|
'use strict';
|
|
2751
|
-
|
|
2837
|
+
/**
|
|
2838
|
+
* @module JSONStream
|
|
2839
|
+
*/
|
|
2752
2840
|
/**
|
|
2753
2841
|
* Module dependencies.
|
|
2754
2842
|
*/
|
|
@@ -2762,8 +2850,13 @@ var Base = require('./base');
|
|
|
2762
2850
|
exports = module.exports = List;
|
|
2763
2851
|
|
|
2764
2852
|
/**
|
|
2765
|
-
* Initialize a new `
|
|
2853
|
+
* Initialize a new `JSONStream` test reporter.
|
|
2766
2854
|
*
|
|
2855
|
+
* @public
|
|
2856
|
+
* @name JSONStream
|
|
2857
|
+
* @class JSONStream
|
|
2858
|
+
* @memberof Mocha.reporters
|
|
2859
|
+
* @extends Mocha.reporters.Base
|
|
2767
2860
|
* @api public
|
|
2768
2861
|
* @param {Runner} runner
|
|
2769
2862
|
*/
|
|
@@ -2814,7 +2907,9 @@ function clean (test) {
|
|
|
2814
2907
|
},{"./base":16,"_process":56}],22:[function(require,module,exports){
|
|
2815
2908
|
(function (process){
|
|
2816
2909
|
'use strict';
|
|
2817
|
-
|
|
2910
|
+
/**
|
|
2911
|
+
* @module JSON
|
|
2912
|
+
*/
|
|
2818
2913
|
/**
|
|
2819
2914
|
* Module dependencies.
|
|
2820
2915
|
*/
|
|
@@ -2830,6 +2925,10 @@ exports = module.exports = JSONReporter;
|
|
|
2830
2925
|
/**
|
|
2831
2926
|
* Initialize a new `JSON` reporter.
|
|
2832
2927
|
*
|
|
2928
|
+
* @public
|
|
2929
|
+
* @class JSON
|
|
2930
|
+
* @memberof Mocha.reporters
|
|
2931
|
+
* @extends Mocha.reporters.Base
|
|
2833
2932
|
* @api public
|
|
2834
2933
|
* @param {Runner} runner
|
|
2835
2934
|
*/
|
|
@@ -2882,17 +2981,44 @@ function JSONReporter (runner) {
|
|
|
2882
2981
|
* @return {Object}
|
|
2883
2982
|
*/
|
|
2884
2983
|
function clean (test) {
|
|
2984
|
+
var err = test.err || {};
|
|
2985
|
+
if (err instanceof Error) {
|
|
2986
|
+
err = errorJSON(err);
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2885
2989
|
return {
|
|
2886
2990
|
title: test.title,
|
|
2887
2991
|
fullTitle: test.fullTitle(),
|
|
2888
2992
|
duration: test.duration,
|
|
2889
2993
|
currentRetry: test.currentRetry(),
|
|
2890
|
-
err:
|
|
2994
|
+
err: cleanCycles(err)
|
|
2891
2995
|
};
|
|
2892
2996
|
}
|
|
2893
2997
|
|
|
2894
2998
|
/**
|
|
2895
|
-
*
|
|
2999
|
+
* Replaces any circular references inside `obj` with '[object Object]'
|
|
3000
|
+
*
|
|
3001
|
+
* @api private
|
|
3002
|
+
* @param {Object} obj
|
|
3003
|
+
* @return {Object}
|
|
3004
|
+
*/
|
|
3005
|
+
function cleanCycles (obj) {
|
|
3006
|
+
var cache = [];
|
|
3007
|
+
return JSON.parse(JSON.stringify(obj, function (key, value) {
|
|
3008
|
+
if (typeof value === 'object' && value !== null) {
|
|
3009
|
+
if (cache.indexOf(value) !== -1) {
|
|
3010
|
+
// Instead of going in a circle, we'll print [object Object]
|
|
3011
|
+
return '' + value;
|
|
3012
|
+
}
|
|
3013
|
+
cache.push(value);
|
|
3014
|
+
}
|
|
3015
|
+
|
|
3016
|
+
return value;
|
|
3017
|
+
}));
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
/**
|
|
3021
|
+
* Transform an Error object into a JSON object.
|
|
2896
3022
|
*
|
|
2897
3023
|
* @api private
|
|
2898
3024
|
* @param {Error} err
|
|
@@ -2910,7 +3036,9 @@ function errorJSON (err) {
|
|
|
2910
3036
|
},{"./base":16,"_process":56}],23:[function(require,module,exports){
|
|
2911
3037
|
(function (process){
|
|
2912
3038
|
'use strict';
|
|
2913
|
-
|
|
3039
|
+
/**
|
|
3040
|
+
* @module Landing
|
|
3041
|
+
*/
|
|
2914
3042
|
/**
|
|
2915
3043
|
* Module dependencies.
|
|
2916
3044
|
*/
|
|
@@ -2947,6 +3075,10 @@ Base.colors.runway = 90;
|
|
|
2947
3075
|
/**
|
|
2948
3076
|
* Initialize a new `Landing` reporter.
|
|
2949
3077
|
*
|
|
3078
|
+
* @public
|
|
3079
|
+
* @class
|
|
3080
|
+
* @memberof Mocha.reporters
|
|
3081
|
+
* @extends Mocha.reporters.Base
|
|
2950
3082
|
* @api public
|
|
2951
3083
|
* @param {Runner} runner
|
|
2952
3084
|
*/
|
|
@@ -3008,7 +3140,9 @@ inherits(Landing, Base);
|
|
|
3008
3140
|
},{"../utils":36,"./base":16,"_process":56}],24:[function(require,module,exports){
|
|
3009
3141
|
(function (process){
|
|
3010
3142
|
'use strict';
|
|
3011
|
-
|
|
3143
|
+
/**
|
|
3144
|
+
* @module List
|
|
3145
|
+
*/
|
|
3012
3146
|
/**
|
|
3013
3147
|
* Module dependencies.
|
|
3014
3148
|
*/
|
|
@@ -3027,6 +3161,10 @@ exports = module.exports = List;
|
|
|
3027
3161
|
/**
|
|
3028
3162
|
* Initialize a new `List` test reporter.
|
|
3029
3163
|
*
|
|
3164
|
+
* @public
|
|
3165
|
+
* @class
|
|
3166
|
+
* @memberof Mocha.reporters
|
|
3167
|
+
* @extends Mocha.reporters.Base
|
|
3030
3168
|
* @api public
|
|
3031
3169
|
* @param {Runner} runner
|
|
3032
3170
|
*/
|
|
@@ -3075,7 +3213,9 @@ inherits(List, Base);
|
|
|
3075
3213
|
},{"../utils":36,"./base":16,"_process":56}],25:[function(require,module,exports){
|
|
3076
3214
|
(function (process){
|
|
3077
3215
|
'use strict';
|
|
3078
|
-
|
|
3216
|
+
/**
|
|
3217
|
+
* @module Markdown
|
|
3218
|
+
*/
|
|
3079
3219
|
/**
|
|
3080
3220
|
* Module dependencies.
|
|
3081
3221
|
*/
|
|
@@ -3098,6 +3238,10 @@ exports = module.exports = Markdown;
|
|
|
3098
3238
|
/**
|
|
3099
3239
|
* Initialize a new `Markdown` reporter.
|
|
3100
3240
|
*
|
|
3241
|
+
* @public
|
|
3242
|
+
* @class
|
|
3243
|
+
* @memberof Mocha.reporters
|
|
3244
|
+
* @extends Mocha.reporters.Base
|
|
3101
3245
|
* @api public
|
|
3102
3246
|
* @param {Runner} runner
|
|
3103
3247
|
*/
|
|
@@ -3178,7 +3322,9 @@ function Markdown (runner) {
|
|
|
3178
3322
|
},{"../utils":36,"./base":16,"_process":56}],26:[function(require,module,exports){
|
|
3179
3323
|
(function (process){
|
|
3180
3324
|
'use strict';
|
|
3181
|
-
|
|
3325
|
+
/**
|
|
3326
|
+
* @module Min
|
|
3327
|
+
*/
|
|
3182
3328
|
/**
|
|
3183
3329
|
* Module dependencies.
|
|
3184
3330
|
*/
|
|
@@ -3195,6 +3341,10 @@ exports = module.exports = Min;
|
|
|
3195
3341
|
/**
|
|
3196
3342
|
* Initialize a new `Min` minimal test reporter (best used with --watch).
|
|
3197
3343
|
*
|
|
3344
|
+
* @public
|
|
3345
|
+
* @class
|
|
3346
|
+
* @memberof Mocha.reporters
|
|
3347
|
+
* @extends Mocha.reporters.Base
|
|
3198
3348
|
* @api public
|
|
3199
3349
|
* @param {Runner} runner
|
|
3200
3350
|
*/
|
|
@@ -3220,7 +3370,9 @@ inherits(Min, Base);
|
|
|
3220
3370
|
},{"../utils":36,"./base":16,"_process":56}],27:[function(require,module,exports){
|
|
3221
3371
|
(function (process){
|
|
3222
3372
|
'use strict';
|
|
3223
|
-
|
|
3373
|
+
/**
|
|
3374
|
+
* @module Nyan
|
|
3375
|
+
*/
|
|
3224
3376
|
/**
|
|
3225
3377
|
* Module dependencies.
|
|
3226
3378
|
*/
|
|
@@ -3239,6 +3391,10 @@ exports = module.exports = NyanCat;
|
|
|
3239
3391
|
*
|
|
3240
3392
|
* @param {Runner} runner
|
|
3241
3393
|
* @api public
|
|
3394
|
+
* @public
|
|
3395
|
+
* @class Nyan
|
|
3396
|
+
* @memberof Mocha.reporters
|
|
3397
|
+
* @extends Mocha.reporters.Base
|
|
3242
3398
|
*/
|
|
3243
3399
|
|
|
3244
3400
|
function NyanCat (runner) {
|
|
@@ -3487,7 +3643,9 @@ function write (string) {
|
|
|
3487
3643
|
},{"../utils":36,"./base":16,"_process":56}],28:[function(require,module,exports){
|
|
3488
3644
|
(function (process){
|
|
3489
3645
|
'use strict';
|
|
3490
|
-
|
|
3646
|
+
/**
|
|
3647
|
+
* @module Progress
|
|
3648
|
+
*/
|
|
3491
3649
|
/**
|
|
3492
3650
|
* Module dependencies.
|
|
3493
3651
|
*/
|
|
@@ -3512,6 +3670,10 @@ Base.colors.progress = 90;
|
|
|
3512
3670
|
/**
|
|
3513
3671
|
* Initialize a new `Progress` bar test reporter.
|
|
3514
3672
|
*
|
|
3673
|
+
* @public
|
|
3674
|
+
* @class
|
|
3675
|
+
* @memberof Mocha.reporters
|
|
3676
|
+
* @extends Mocha.reporters.Base
|
|
3515
3677
|
* @api public
|
|
3516
3678
|
* @param {Runner} runner
|
|
3517
3679
|
* @param {Object} options
|
|
@@ -3583,7 +3745,9 @@ inherits(Progress, Base);
|
|
|
3583
3745
|
}).call(this,require('_process'))
|
|
3584
3746
|
},{"../utils":36,"./base":16,"_process":56}],29:[function(require,module,exports){
|
|
3585
3747
|
'use strict';
|
|
3586
|
-
|
|
3748
|
+
/**
|
|
3749
|
+
* @module Spec
|
|
3750
|
+
*/
|
|
3587
3751
|
/**
|
|
3588
3752
|
* Module dependencies.
|
|
3589
3753
|
*/
|
|
@@ -3601,6 +3765,10 @@ exports = module.exports = Spec;
|
|
|
3601
3765
|
/**
|
|
3602
3766
|
* Initialize a new `Spec` test reporter.
|
|
3603
3767
|
*
|
|
3768
|
+
* @public
|
|
3769
|
+
* @class
|
|
3770
|
+
* @memberof Mocha.reporters
|
|
3771
|
+
* @extends Mocha.reporters.Base
|
|
3604
3772
|
* @api public
|
|
3605
3773
|
* @param {Runner} runner
|
|
3606
3774
|
*/
|
|
@@ -3666,7 +3834,9 @@ inherits(Spec, Base);
|
|
|
3666
3834
|
|
|
3667
3835
|
},{"../utils":36,"./base":16}],30:[function(require,module,exports){
|
|
3668
3836
|
'use strict';
|
|
3669
|
-
|
|
3837
|
+
/**
|
|
3838
|
+
* @module TAP
|
|
3839
|
+
*/
|
|
3670
3840
|
/**
|
|
3671
3841
|
* Module dependencies.
|
|
3672
3842
|
*/
|
|
@@ -3682,6 +3852,10 @@ exports = module.exports = TAP;
|
|
|
3682
3852
|
/**
|
|
3683
3853
|
* Initialize a new `TAP` reporter.
|
|
3684
3854
|
*
|
|
3855
|
+
* @public
|
|
3856
|
+
* @class
|
|
3857
|
+
* @memberof Mocha.reporters
|
|
3858
|
+
* @extends Mocha.reporters.Base
|
|
3685
3859
|
* @api public
|
|
3686
3860
|
* @param {Runner} runner
|
|
3687
3861
|
*/
|
|
@@ -3739,7 +3913,9 @@ function title (test) {
|
|
|
3739
3913
|
},{"./base":16}],31:[function(require,module,exports){
|
|
3740
3914
|
(function (process,global){
|
|
3741
3915
|
'use strict';
|
|
3742
|
-
|
|
3916
|
+
/**
|
|
3917
|
+
* @module XUnit
|
|
3918
|
+
*/
|
|
3743
3919
|
/**
|
|
3744
3920
|
* Module dependencies.
|
|
3745
3921
|
*/
|
|
@@ -3773,6 +3949,10 @@ exports = module.exports = XUnit;
|
|
|
3773
3949
|
/**
|
|
3774
3950
|
* Initialize a new `XUnit` reporter.
|
|
3775
3951
|
*
|
|
3952
|
+
* @public
|
|
3953
|
+
* @class
|
|
3954
|
+
* @memberof Mocha.reporters
|
|
3955
|
+
* @extends Mocha.reporters.Base
|
|
3776
3956
|
* @api public
|
|
3777
3957
|
* @param {Runner} runner
|
|
3778
3958
|
*/
|
|
@@ -3926,11 +4106,12 @@ function tag (name, attrs, close, content) {
|
|
|
3926
4106
|
},{"../utils":36,"./base":16,"_process":56,"fs":40,"mkdirp":53,"path":40}],32:[function(require,module,exports){
|
|
3927
4107
|
(function (global){
|
|
3928
4108
|
'use strict';
|
|
3929
|
-
|
|
4109
|
+
/**
|
|
4110
|
+
* @module Runnable
|
|
4111
|
+
*/
|
|
3930
4112
|
/**
|
|
3931
4113
|
* Module dependencies.
|
|
3932
4114
|
*/
|
|
3933
|
-
|
|
3934
4115
|
var EventEmitter = require('events').EventEmitter;
|
|
3935
4116
|
var Pending = require('./pending');
|
|
3936
4117
|
var debug = require('debug')('mocha:runnable');
|
|
@@ -3962,13 +4143,13 @@ var toString = Object.prototype.toString;
|
|
|
3962
4143
|
module.exports = Runnable;
|
|
3963
4144
|
|
|
3964
4145
|
/**
|
|
3965
|
-
* Initialize a new `Runnable` with the given `title` and callback `fn`.
|
|
4146
|
+
* Initialize a new `Runnable` with the given `title` and callback `fn`. Derived from [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
|
|
3966
4147
|
*
|
|
4148
|
+
* @memberof Mocha
|
|
4149
|
+
* @public
|
|
4150
|
+
* @class
|
|
3967
4151
|
* @param {String} title
|
|
3968
4152
|
* @param {Function} fn
|
|
3969
|
-
* @api private
|
|
3970
|
-
* @param {string} title
|
|
3971
|
-
* @param {Function} fn
|
|
3972
4153
|
*/
|
|
3973
4154
|
function Runnable (title, fn) {
|
|
3974
4155
|
this.title = title;
|
|
@@ -4030,7 +4211,7 @@ Runnable.prototype.slow = function (ms) {
|
|
|
4030
4211
|
if (typeof ms === 'string') {
|
|
4031
4212
|
ms = milliseconds(ms);
|
|
4032
4213
|
}
|
|
4033
|
-
debug('
|
|
4214
|
+
debug('slow %d', ms);
|
|
4034
4215
|
this._slow = ms;
|
|
4035
4216
|
return this;
|
|
4036
4217
|
};
|
|
@@ -4054,6 +4235,8 @@ Runnable.prototype.enableTimeouts = function (enabled) {
|
|
|
4054
4235
|
/**
|
|
4055
4236
|
* Halt and mark as pending.
|
|
4056
4237
|
*
|
|
4238
|
+
* @memberof Mocha.Runnable
|
|
4239
|
+
* @public
|
|
4057
4240
|
* @api public
|
|
4058
4241
|
*/
|
|
4059
4242
|
Runnable.prototype.skip = function () {
|
|
@@ -4115,6 +4298,8 @@ Runnable.prototype.currentRetry = function (n) {
|
|
|
4115
4298
|
* Return the full title generated by recursively concatenating the parent's
|
|
4116
4299
|
* full title.
|
|
4117
4300
|
*
|
|
4301
|
+
* @memberof Mocha.Runnable
|
|
4302
|
+
* @public
|
|
4118
4303
|
* @api public
|
|
4119
4304
|
* @return {string}
|
|
4120
4305
|
*/
|
|
@@ -4125,6 +4310,8 @@ Runnable.prototype.fullTitle = function () {
|
|
|
4125
4310
|
/**
|
|
4126
4311
|
* Return the title path generated by concatenating the parent's title path with the title.
|
|
4127
4312
|
*
|
|
4313
|
+
* @memberof Mocha.Runnable
|
|
4314
|
+
* @public
|
|
4128
4315
|
* @api public
|
|
4129
4316
|
* @return {string}
|
|
4130
4317
|
*/
|
|
@@ -4179,8 +4366,7 @@ Runnable.prototype.resetTimeout = function () {
|
|
|
4179
4366
|
if (!self._enableTimeouts) {
|
|
4180
4367
|
return;
|
|
4181
4368
|
}
|
|
4182
|
-
self.callback(
|
|
4183
|
-
'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.'));
|
|
4369
|
+
self.callback(self._timeoutError(ms));
|
|
4184
4370
|
self.timedOut = true;
|
|
4185
4371
|
}, ms);
|
|
4186
4372
|
};
|
|
@@ -4246,8 +4432,7 @@ Runnable.prototype.run = function (fn) {
|
|
|
4246
4432
|
self.duration = new Date() - start;
|
|
4247
4433
|
finished = true;
|
|
4248
4434
|
if (!err && self.duration > ms && self._enableTimeouts) {
|
|
4249
|
-
err =
|
|
4250
|
-
'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.');
|
|
4435
|
+
err = self._timeoutError(ms);
|
|
4251
4436
|
}
|
|
4252
4437
|
fn(err);
|
|
4253
4438
|
}
|
|
@@ -4345,15 +4530,32 @@ Runnable.prototype.run = function (fn) {
|
|
|
4345
4530
|
}
|
|
4346
4531
|
};
|
|
4347
4532
|
|
|
4533
|
+
/**
|
|
4534
|
+
* Instantiates a "timeout" error
|
|
4535
|
+
*
|
|
4536
|
+
* @param {number} ms - Timeout (in milliseconds)
|
|
4537
|
+
* @returns {Error} a "timeout" error
|
|
4538
|
+
* @private
|
|
4539
|
+
*/
|
|
4540
|
+
Runnable.prototype._timeoutError = function (ms) {
|
|
4541
|
+
var msg = 'Timeout of ' + ms + 'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.';
|
|
4542
|
+
if (this.file) {
|
|
4543
|
+
msg += ' (' + this.file + ')';
|
|
4544
|
+
}
|
|
4545
|
+
return new Error(msg);
|
|
4546
|
+
};
|
|
4547
|
+
|
|
4348
4548
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
4349
4549
|
},{"./ms":14,"./pending":15,"./utils":36,"debug":43,"events":47}],33:[function(require,module,exports){
|
|
4350
4550
|
(function (process,global){
|
|
4351
4551
|
'use strict';
|
|
4352
4552
|
|
|
4553
|
+
/**
|
|
4554
|
+
* @module Runner
|
|
4555
|
+
*/
|
|
4353
4556
|
/**
|
|
4354
4557
|
* Module dependencies.
|
|
4355
4558
|
*/
|
|
4356
|
-
|
|
4357
4559
|
var EventEmitter = require('events').EventEmitter;
|
|
4358
4560
|
var Pending = require('./pending');
|
|
4359
4561
|
var utils = require('./utils');
|
|
@@ -4387,7 +4589,7 @@ var globals = [
|
|
|
4387
4589
|
module.exports = Runner;
|
|
4388
4590
|
|
|
4389
4591
|
/**
|
|
4390
|
-
* Initialize a `Runner` for the given `suite`.
|
|
4592
|
+
* Initialize a `Runner` for the given `suite`. Derived from [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
|
|
4391
4593
|
*
|
|
4392
4594
|
* Events:
|
|
4393
4595
|
*
|
|
@@ -4403,8 +4605,11 @@ module.exports = Runner;
|
|
|
4403
4605
|
* - `fail` (test, err) test failed
|
|
4404
4606
|
* - `pending` (test) test pending
|
|
4405
4607
|
*
|
|
4608
|
+
* @memberof Mocha
|
|
4609
|
+
* @public
|
|
4610
|
+
* @class
|
|
4406
4611
|
* @api public
|
|
4407
|
-
* @param {Suite} suite Root suite
|
|
4612
|
+
* @param {Suite} [suite] Root suite
|
|
4408
4613
|
* @param {boolean} [delay] Whether or not to delay execution of root suite
|
|
4409
4614
|
* until ready.
|
|
4410
4615
|
*/
|
|
@@ -4445,10 +4650,9 @@ inherits(Runner, EventEmitter);
|
|
|
4445
4650
|
* Run tests with full titles matching `re`. Updates runner.total
|
|
4446
4651
|
* with number of tests matched.
|
|
4447
4652
|
*
|
|
4448
|
-
* @param {RegExp} re
|
|
4449
|
-
* @param {Boolean} invert
|
|
4450
|
-
* @return {Runner} for chaining
|
|
4451
4653
|
* @api public
|
|
4654
|
+
* @public
|
|
4655
|
+
* @memberof Mocha.Runner
|
|
4452
4656
|
* @param {RegExp} re
|
|
4453
4657
|
* @param {boolean} invert
|
|
4454
4658
|
* @return {Runner} Runner instance.
|
|
@@ -4465,9 +4669,9 @@ Runner.prototype.grep = function (re, invert) {
|
|
|
4465
4669
|
* Returns the number of tests matching the grep search for the
|
|
4466
4670
|
* given suite.
|
|
4467
4671
|
*
|
|
4468
|
-
* @
|
|
4469
|
-
* @return {Number}
|
|
4672
|
+
* @memberof Mocha.Runner
|
|
4470
4673
|
* @api public
|
|
4674
|
+
* @public
|
|
4471
4675
|
* @param {Suite} suite
|
|
4472
4676
|
* @return {number}
|
|
4473
4677
|
*/
|
|
@@ -4511,9 +4715,9 @@ Runner.prototype.globalProps = function () {
|
|
|
4511
4715
|
/**
|
|
4512
4716
|
* Allow the given `arr` of globals.
|
|
4513
4717
|
*
|
|
4514
|
-
* @param {Array} arr
|
|
4515
|
-
* @return {Runner} for chaining
|
|
4516
4718
|
* @api public
|
|
4719
|
+
* @public
|
|
4720
|
+
* @memberof Mocha.Runner
|
|
4517
4721
|
* @param {Array} arr
|
|
4518
4722
|
* @return {Runner} Runner instance.
|
|
4519
4723
|
*/
|
|
@@ -4615,10 +4819,10 @@ Runner.prototype.failHook = function (hook, err) {
|
|
|
4615
4819
|
hook.title = hook.originalTitle + ' for "' + hook.ctx.currentTest.title + '"';
|
|
4616
4820
|
}
|
|
4617
4821
|
|
|
4618
|
-
this.fail(hook, err);
|
|
4619
4822
|
if (this.suite.bail()) {
|
|
4620
4823
|
this.emit('end');
|
|
4621
4824
|
}
|
|
4825
|
+
this.fail(hook, err);
|
|
4622
4826
|
};
|
|
4623
4827
|
|
|
4624
4828
|
/**
|
|
@@ -5154,9 +5358,9 @@ function cleanSuiteReferences (suite) {
|
|
|
5154
5358
|
* Run the root suite and invoke `fn(failures)`
|
|
5155
5359
|
* on completion.
|
|
5156
5360
|
*
|
|
5157
|
-
* @param {Function} fn
|
|
5158
|
-
* @return {Runner} for chaining
|
|
5159
5361
|
* @api public
|
|
5362
|
+
* @public
|
|
5363
|
+
* @memberof Mocha.Runner
|
|
5160
5364
|
* @param {Function} fn
|
|
5161
5365
|
* @return {Runner} Runner instance.
|
|
5162
5366
|
*/
|
|
@@ -5213,6 +5417,8 @@ Runner.prototype.run = function (fn) {
|
|
|
5213
5417
|
/**
|
|
5214
5418
|
* Cleanly abort execution.
|
|
5215
5419
|
*
|
|
5420
|
+
* @memberof Mocha.Runner
|
|
5421
|
+
* @public
|
|
5216
5422
|
* @api public
|
|
5217
5423
|
* @return {Runner} Runner instance.
|
|
5218
5424
|
*/
|
|
@@ -5334,11 +5540,13 @@ function extraGlobals () {
|
|
|
5334
5540
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
5335
5541
|
},{"./pending":15,"./runnable":32,"./utils":36,"_process":56,"debug":43,"events":47}],34:[function(require,module,exports){
|
|
5336
5542
|
'use strict';
|
|
5543
|
+
/**
|
|
5544
|
+
* @module Suite
|
|
5545
|
+
*/
|
|
5337
5546
|
|
|
5338
5547
|
/**
|
|
5339
5548
|
* Module dependencies.
|
|
5340
5549
|
*/
|
|
5341
|
-
|
|
5342
5550
|
var EventEmitter = require('events').EventEmitter;
|
|
5343
5551
|
var Hook = require('./hook');
|
|
5344
5552
|
var utils = require('./utils');
|
|
@@ -5357,6 +5565,8 @@ exports = module.exports = Suite;
|
|
|
5357
5565
|
* with the same title is already present, that suite is returned to provide
|
|
5358
5566
|
* nicer reporter and more flexible meta-testing.
|
|
5359
5567
|
*
|
|
5568
|
+
* @memberof Mocha
|
|
5569
|
+
* @public
|
|
5360
5570
|
* @api public
|
|
5361
5571
|
* @param {Suite} parent
|
|
5362
5572
|
* @param {string} title
|
|
@@ -5371,9 +5581,11 @@ exports.create = function (parent, title) {
|
|
|
5371
5581
|
};
|
|
5372
5582
|
|
|
5373
5583
|
/**
|
|
5374
|
-
* Initialize a new `Suite` with the given `title` and `ctx`.
|
|
5584
|
+
* Initialize a new `Suite` with the given `title` and `ctx`. Derived from [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
|
|
5375
5585
|
*
|
|
5376
|
-
* @
|
|
5586
|
+
* @memberof Mocha
|
|
5587
|
+
* @public
|
|
5588
|
+
* @class
|
|
5377
5589
|
* @param {string} title
|
|
5378
5590
|
* @param {Context} parentContext
|
|
5379
5591
|
*/
|
|
@@ -5524,6 +5736,25 @@ Suite.prototype.isPending = function () {
|
|
|
5524
5736
|
return this.pending || (this.parent && this.parent.isPending());
|
|
5525
5737
|
};
|
|
5526
5738
|
|
|
5739
|
+
/**
|
|
5740
|
+
* Generic hook-creator.
|
|
5741
|
+
* @private
|
|
5742
|
+
* @param {string} title - Title of hook
|
|
5743
|
+
* @param {Function} fn - Hook callback
|
|
5744
|
+
* @returns {Hook} A new hook
|
|
5745
|
+
*/
|
|
5746
|
+
Suite.prototype._createHook = function (title, fn) {
|
|
5747
|
+
var hook = new Hook(title, fn);
|
|
5748
|
+
hook.parent = this;
|
|
5749
|
+
hook.timeout(this.timeout());
|
|
5750
|
+
hook.retries(this.retries());
|
|
5751
|
+
hook.enableTimeouts(this.enableTimeouts());
|
|
5752
|
+
hook.slow(this.slow());
|
|
5753
|
+
hook.ctx = this.ctx;
|
|
5754
|
+
hook.file = this.file;
|
|
5755
|
+
return hook;
|
|
5756
|
+
};
|
|
5757
|
+
|
|
5527
5758
|
/**
|
|
5528
5759
|
* Run `fn(test[, done])` before running tests.
|
|
5529
5760
|
*
|
|
@@ -5542,13 +5773,7 @@ Suite.prototype.beforeAll = function (title, fn) {
|
|
|
5542
5773
|
}
|
|
5543
5774
|
title = '"before all" hook' + (title ? ': ' + title : '');
|
|
5544
5775
|
|
|
5545
|
-
var hook =
|
|
5546
|
-
hook.parent = this;
|
|
5547
|
-
hook.timeout(this.timeout());
|
|
5548
|
-
hook.retries(this.retries());
|
|
5549
|
-
hook.enableTimeouts(this.enableTimeouts());
|
|
5550
|
-
hook.slow(this.slow());
|
|
5551
|
-
hook.ctx = this.ctx;
|
|
5776
|
+
var hook = this._createHook(title, fn);
|
|
5552
5777
|
this._beforeAll.push(hook);
|
|
5553
5778
|
this.emit('beforeAll', hook);
|
|
5554
5779
|
return this;
|
|
@@ -5572,13 +5797,7 @@ Suite.prototype.afterAll = function (title, fn) {
|
|
|
5572
5797
|
}
|
|
5573
5798
|
title = '"after all" hook' + (title ? ': ' + title : '');
|
|
5574
5799
|
|
|
5575
|
-
var hook =
|
|
5576
|
-
hook.parent = this;
|
|
5577
|
-
hook.timeout(this.timeout());
|
|
5578
|
-
hook.retries(this.retries());
|
|
5579
|
-
hook.enableTimeouts(this.enableTimeouts());
|
|
5580
|
-
hook.slow(this.slow());
|
|
5581
|
-
hook.ctx = this.ctx;
|
|
5800
|
+
var hook = this._createHook(title, fn);
|
|
5582
5801
|
this._afterAll.push(hook);
|
|
5583
5802
|
this.emit('afterAll', hook);
|
|
5584
5803
|
return this;
|
|
@@ -5602,13 +5821,7 @@ Suite.prototype.beforeEach = function (title, fn) {
|
|
|
5602
5821
|
}
|
|
5603
5822
|
title = '"before each" hook' + (title ? ': ' + title : '');
|
|
5604
5823
|
|
|
5605
|
-
var hook =
|
|
5606
|
-
hook.parent = this;
|
|
5607
|
-
hook.timeout(this.timeout());
|
|
5608
|
-
hook.retries(this.retries());
|
|
5609
|
-
hook.enableTimeouts(this.enableTimeouts());
|
|
5610
|
-
hook.slow(this.slow());
|
|
5611
|
-
hook.ctx = this.ctx;
|
|
5824
|
+
var hook = this._createHook(title, fn);
|
|
5612
5825
|
this._beforeEach.push(hook);
|
|
5613
5826
|
this.emit('beforeEach', hook);
|
|
5614
5827
|
return this;
|
|
@@ -5632,13 +5845,7 @@ Suite.prototype.afterEach = function (title, fn) {
|
|
|
5632
5845
|
}
|
|
5633
5846
|
title = '"after each" hook' + (title ? ': ' + title : '');
|
|
5634
5847
|
|
|
5635
|
-
var hook =
|
|
5636
|
-
hook.parent = this;
|
|
5637
|
-
hook.timeout(this.timeout());
|
|
5638
|
-
hook.retries(this.retries());
|
|
5639
|
-
hook.enableTimeouts(this.enableTimeouts());
|
|
5640
|
-
hook.slow(this.slow());
|
|
5641
|
-
hook.ctx = this.ctx;
|
|
5848
|
+
var hook = this._createHook(title, fn);
|
|
5642
5849
|
this._afterEach.push(hook);
|
|
5643
5850
|
this.emit('afterEach', hook);
|
|
5644
5851
|
return this;
|
|
@@ -5686,6 +5893,8 @@ Suite.prototype.addTest = function (test) {
|
|
|
5686
5893
|
* Return the full title generated by recursively concatenating the parent's
|
|
5687
5894
|
* full title.
|
|
5688
5895
|
*
|
|
5896
|
+
* @memberof Mocha.Suite
|
|
5897
|
+
* @public
|
|
5689
5898
|
* @api public
|
|
5690
5899
|
* @return {string}
|
|
5691
5900
|
*/
|
|
@@ -5697,6 +5906,8 @@ Suite.prototype.fullTitle = function () {
|
|
|
5697
5906
|
* Return the title path generated by recursively concatenating the parent's
|
|
5698
5907
|
* title path.
|
|
5699
5908
|
*
|
|
5909
|
+
* @memberof Mocha.Suite
|
|
5910
|
+
* @public
|
|
5700
5911
|
* @api public
|
|
5701
5912
|
* @return {string}
|
|
5702
5913
|
*/
|
|
@@ -5714,6 +5925,8 @@ Suite.prototype.titlePath = function () {
|
|
|
5714
5925
|
/**
|
|
5715
5926
|
* Return the total number of tests.
|
|
5716
5927
|
*
|
|
5928
|
+
* @memberof Mocha.Suite
|
|
5929
|
+
* @public
|
|
5717
5930
|
* @api public
|
|
5718
5931
|
* @return {number}
|
|
5719
5932
|
*/
|
|
@@ -5804,6 +6017,10 @@ Test.prototype.clone = function () {
|
|
|
5804
6017
|
(function (process,Buffer){
|
|
5805
6018
|
'use strict';
|
|
5806
6019
|
|
|
6020
|
+
/**
|
|
6021
|
+
* @module
|
|
6022
|
+
*/
|
|
6023
|
+
|
|
5807
6024
|
/**
|
|
5808
6025
|
* Module dependencies.
|
|
5809
6026
|
*/
|
|
@@ -5812,8 +6029,15 @@ var debug = require('debug')('mocha:watch');
|
|
|
5812
6029
|
var fs = require('fs');
|
|
5813
6030
|
var glob = require('glob');
|
|
5814
6031
|
var path = require('path');
|
|
6032
|
+
var join = path.join;
|
|
5815
6033
|
var he = require('he');
|
|
5816
6034
|
|
|
6035
|
+
/**
|
|
6036
|
+
* Ignored directories.
|
|
6037
|
+
*/
|
|
6038
|
+
|
|
6039
|
+
var ignore = ['node_modules', '.git'];
|
|
6040
|
+
|
|
5817
6041
|
exports.inherits = require('util').inherits;
|
|
5818
6042
|
|
|
5819
6043
|
/**
|
|
@@ -5858,6 +6082,46 @@ exports.watch = function (files, fn) {
|
|
|
5858
6082
|
});
|
|
5859
6083
|
};
|
|
5860
6084
|
|
|
6085
|
+
/**
|
|
6086
|
+
* Ignored files.
|
|
6087
|
+
*
|
|
6088
|
+
* @api private
|
|
6089
|
+
* @param {string} path
|
|
6090
|
+
* @return {boolean}
|
|
6091
|
+
*/
|
|
6092
|
+
function ignored (path) {
|
|
6093
|
+
return !~ignore.indexOf(path);
|
|
6094
|
+
}
|
|
6095
|
+
|
|
6096
|
+
/**
|
|
6097
|
+
* Lookup files in the given `dir`.
|
|
6098
|
+
*
|
|
6099
|
+
* @api private
|
|
6100
|
+
* @param {string} dir
|
|
6101
|
+
* @param {string[]} [ext=['.js']]
|
|
6102
|
+
* @param {Array} [ret=[]]
|
|
6103
|
+
* @return {Array}
|
|
6104
|
+
*/
|
|
6105
|
+
exports.files = function (dir, ext, ret) {
|
|
6106
|
+
ret = ret || [];
|
|
6107
|
+
ext = ext || ['js'];
|
|
6108
|
+
|
|
6109
|
+
var re = new RegExp('\\.(' + ext.join('|') + ')$');
|
|
6110
|
+
|
|
6111
|
+
fs.readdirSync(dir)
|
|
6112
|
+
.filter(ignored)
|
|
6113
|
+
.forEach(function (path) {
|
|
6114
|
+
path = join(dir, path);
|
|
6115
|
+
if (fs.lstatSync(path).isDirectory()) {
|
|
6116
|
+
exports.files(path, ext, ret);
|
|
6117
|
+
} else if (path.match(re)) {
|
|
6118
|
+
ret.push(path);
|
|
6119
|
+
}
|
|
6120
|
+
});
|
|
6121
|
+
|
|
6122
|
+
return ret;
|
|
6123
|
+
};
|
|
6124
|
+
|
|
5861
6125
|
/**
|
|
5862
6126
|
* Compute a slug from the given `str`.
|
|
5863
6127
|
*
|
|
@@ -6218,6 +6482,8 @@ exports.canonicalize = function canonicalize (value, stack, typeHint) {
|
|
|
6218
6482
|
/**
|
|
6219
6483
|
* Lookup file names at the given `path`.
|
|
6220
6484
|
*
|
|
6485
|
+
* @memberof Mocha.utils
|
|
6486
|
+
* @public
|
|
6221
6487
|
* @api public
|
|
6222
6488
|
* @param {string} filepath Base path to start searching from.
|
|
6223
6489
|
* @param {string[]} extensions File extensions to look for.
|
|
@@ -8780,7 +9046,7 @@ function coerce(val) {
|
|
|
8780
9046
|
},{"ms":54}],45:[function(require,module,exports){
|
|
8781
9047
|
/*!
|
|
8782
9048
|
|
|
8783
|
-
diff v3.
|
|
9049
|
+
diff v3.5.0
|
|
8784
9050
|
|
|
8785
9051
|
Software License Agreement (BSD License)
|
|
8786
9052
|
|
|
@@ -9103,7 +9369,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9103
9369
|
return oldPos;
|
|
9104
9370
|
},
|
|
9105
9371
|
/*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
|
|
9106
|
-
|
|
9372
|
+
if (this.options.comparator) {
|
|
9373
|
+
return this.options.comparator(left, right);
|
|
9374
|
+
} else {
|
|
9375
|
+
return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
9376
|
+
}
|
|
9107
9377
|
},
|
|
9108
9378
|
/*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
|
|
9109
9379
|
var ret = [];
|
|
@@ -9166,10 +9436,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9166
9436
|
}
|
|
9167
9437
|
}
|
|
9168
9438
|
|
|
9169
|
-
// Special case handle for when one terminal is ignored.
|
|
9170
|
-
// terminal into the prior string and drop the change.
|
|
9439
|
+
// Special case handle for when one terminal is ignored (i.e. whitespace).
|
|
9440
|
+
// For this case we merge the terminal into the prior string and drop the change.
|
|
9441
|
+
// This is only available for string mode.
|
|
9171
9442
|
var lastComponent = components[componentLen - 1];
|
|
9172
|
-
if (componentLen > 1 && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
|
|
9443
|
+
if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
|
|
9173
9444
|
components[componentLen - 2].value += lastComponent.value;
|
|
9174
9445
|
components.pop();
|
|
9175
9446
|
}
|
|
@@ -9447,16 +9718,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9447
9718
|
|
|
9448
9719
|
jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize;
|
|
9449
9720
|
jsonDiff.castInput = function (value) {
|
|
9450
|
-
/*istanbul ignore start*/var /*istanbul ignore end*/
|
|
9721
|
+
/*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options,
|
|
9722
|
+
undefinedReplacement = _options.undefinedReplacement,
|
|
9723
|
+
_options$stringifyRep = _options.stringifyReplacer,
|
|
9724
|
+
stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{
|
|
9725
|
+
return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v
|
|
9726
|
+
);
|
|
9727
|
+
} : _options$stringifyRep;
|
|
9451
9728
|
|
|
9452
9729
|
|
|
9453
|
-
return typeof value === 'string' ? value : JSON.stringify(canonicalize(value
|
|
9454
|
-
if (typeof v === 'undefined') {
|
|
9455
|
-
return undefinedReplacement;
|
|
9456
|
-
}
|
|
9457
|
-
|
|
9458
|
-
return v;
|
|
9459
|
-
}, ' ');
|
|
9730
|
+
return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
|
|
9460
9731
|
};
|
|
9461
9732
|
jsonDiff.equals = function (left, right) {
|
|
9462
9733
|
return (/*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
|
|
@@ -9468,11 +9739,15 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9468
9739
|
}
|
|
9469
9740
|
|
|
9470
9741
|
// This function handles the presence of circular references by bailing out when encountering an
|
|
9471
|
-
// object that is already on the "stack" of items being processed.
|
|
9472
|
-
function canonicalize(obj, stack, replacementStack) {
|
|
9742
|
+
// object that is already on the "stack" of items being processed. Accepts an optional replacer
|
|
9743
|
+
function canonicalize(obj, stack, replacementStack, replacer, key) {
|
|
9473
9744
|
stack = stack || [];
|
|
9474
9745
|
replacementStack = replacementStack || [];
|
|
9475
9746
|
|
|
9747
|
+
if (replacer) {
|
|
9748
|
+
obj = replacer(key, obj);
|
|
9749
|
+
}
|
|
9750
|
+
|
|
9476
9751
|
var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
|
9477
9752
|
|
|
9478
9753
|
for (i = 0; i < stack.length; i += 1) {
|
|
@@ -9488,7 +9763,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9488
9763
|
canonicalizedObj = new Array(obj.length);
|
|
9489
9764
|
replacementStack.push(canonicalizedObj);
|
|
9490
9765
|
for (i = 0; i < obj.length; i += 1) {
|
|
9491
|
-
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack);
|
|
9766
|
+
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
|
|
9492
9767
|
}
|
|
9493
9768
|
stack.pop();
|
|
9494
9769
|
replacementStack.pop();
|
|
@@ -9504,17 +9779,17 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9504
9779
|
canonicalizedObj = {};
|
|
9505
9780
|
replacementStack.push(canonicalizedObj);
|
|
9506
9781
|
var sortedKeys = [],
|
|
9507
|
-
|
|
9508
|
-
for (
|
|
9782
|
+
_key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
|
9783
|
+
for (_key in obj) {
|
|
9509
9784
|
/* istanbul ignore else */
|
|
9510
|
-
if (obj.hasOwnProperty(
|
|
9511
|
-
sortedKeys.push(
|
|
9785
|
+
if (obj.hasOwnProperty(_key)) {
|
|
9786
|
+
sortedKeys.push(_key);
|
|
9512
9787
|
}
|
|
9513
9788
|
}
|
|
9514
9789
|
sortedKeys.sort();
|
|
9515
9790
|
for (i = 0; i < sortedKeys.length; i += 1) {
|
|
9516
|
-
|
|
9517
|
-
canonicalizedObj[
|
|
9791
|
+
_key = sortedKeys[i];
|
|
9792
|
+
canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
|
|
9518
9793
|
}
|
|
9519
9794
|
stack.pop();
|
|
9520
9795
|
replacementStack.pop();
|
|
@@ -9543,9 +9818,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9543
9818
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
9544
9819
|
|
|
9545
9820
|
/*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
|
9546
|
-
arrayDiff.tokenize =
|
|
9821
|
+
arrayDiff.tokenize = function (value) {
|
|
9547
9822
|
return value.slice();
|
|
9548
9823
|
};
|
|
9824
|
+
arrayDiff.join = arrayDiff.removeEmpty = function (value) {
|
|
9825
|
+
return value;
|
|
9826
|
+
};
|
|
9549
9827
|
|
|
9550
9828
|
function diffArrays(oldArr, newArr, callback) {
|
|
9551
9829
|
return arrayDiff.diff(oldArr, newArr, callback);
|
|
@@ -9607,8 +9885,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9607
9885
|
function hunkFits(hunk, toPos) {
|
|
9608
9886
|
for (var j = 0; j < hunk.lines.length; j++) {
|
|
9609
9887
|
var line = hunk.lines[j],
|
|
9610
|
-
operation = line[0],
|
|
9611
|
-
content = line.substr(1);
|
|
9888
|
+
operation = line.length > 0 ? line[0] : ' ',
|
|
9889
|
+
content = line.length > 0 ? line.substr(1) : line;
|
|
9612
9890
|
|
|
9613
9891
|
if (operation === ' ' || operation === '-') {
|
|
9614
9892
|
// Context sanity check
|
|
@@ -9665,8 +9943,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9665
9943
|
|
|
9666
9944
|
for (var j = 0; j < _hunk.lines.length; j++) {
|
|
9667
9945
|
var line = _hunk.lines[j],
|
|
9668
|
-
operation = line[0],
|
|
9669
|
-
content = line.substr(1),
|
|
9946
|
+
operation = line.length > 0 ? line[0] : ' ',
|
|
9947
|
+
content = line.length > 0 ? line.substr(1) : line,
|
|
9670
9948
|
delimiter = _hunk.linedelimiters[j];
|
|
9671
9949
|
|
|
9672
9950
|
if (operation === ' ') {
|
|
@@ -9804,16 +10082,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9804
10082
|
// Parses the --- and +++ headers, if none are found, no lines
|
|
9805
10083
|
// are consumed.
|
|
9806
10084
|
function parseFileHeader(index) {
|
|
9807
|
-
var
|
|
9808
|
-
var fileHeader = headerPattern.exec(diffstr[i]);
|
|
10085
|
+
var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
|
|
9809
10086
|
if (fileHeader) {
|
|
9810
10087
|
var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
|
|
9811
|
-
var
|
|
10088
|
+
var data = fileHeader[2].split('\t', 2);
|
|
10089
|
+
var fileName = data[0].replace(/\\\\/g, '\\');
|
|
9812
10090
|
if (/^".*"$/.test(fileName)) {
|
|
9813
10091
|
fileName = fileName.substr(1, fileName.length - 2);
|
|
9814
10092
|
}
|
|
9815
10093
|
index[keyPrefix + 'FileName'] = fileName;
|
|
9816
|
-
index[keyPrefix + 'Header'] =
|
|
10094
|
+
index[keyPrefix + 'Header'] = (data[1] || '').trim();
|
|
9817
10095
|
|
|
9818
10096
|
i++;
|
|
9819
10097
|
}
|
|
@@ -9843,7 +10121,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9843
10121
|
if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
|
|
9844
10122
|
break;
|
|
9845
10123
|
}
|
|
9846
|
-
var operation = diffstr[i][0];
|
|
10124
|
+
var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
|
|
9847
10125
|
|
|
9848
10126
|
if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
|
|
9849
10127
|
hunk.lines.push(diffstr[i]);
|
|
@@ -9964,27 +10242,19 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
9964
10242
|
/*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
9965
10243
|
|
|
9966
10244
|
/*istanbul ignore end*/function calcLineCount(hunk) {
|
|
9967
|
-
var
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
hunk.newLines = 0;
|
|
9971
|
-
|
|
9972
|
-
hunk.lines.forEach(function (line) {
|
|
9973
|
-
if (typeof line !== 'string') {
|
|
9974
|
-
conflicted = true;
|
|
9975
|
-
return;
|
|
9976
|
-
}
|
|
10245
|
+
/*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines),
|
|
10246
|
+
oldLines = _calcOldNewLineCount.oldLines,
|
|
10247
|
+
newLines = _calcOldNewLineCount.newLines;
|
|
9977
10248
|
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
if (line[0] === '-' || line[0] === ' ') {
|
|
9982
|
-
hunk.oldLines++;
|
|
9983
|
-
}
|
|
9984
|
-
});
|
|
9985
|
-
|
|
9986
|
-
if (conflicted) {
|
|
10249
|
+
if (oldLines !== undefined) {
|
|
10250
|
+
hunk.oldLines = oldLines;
|
|
10251
|
+
} else {
|
|
9987
10252
|
delete hunk.oldLines;
|
|
10253
|
+
}
|
|
10254
|
+
|
|
10255
|
+
if (newLines !== undefined) {
|
|
10256
|
+
hunk.newLines = newLines;
|
|
10257
|
+
} else {
|
|
9988
10258
|
delete hunk.newLines;
|
|
9989
10259
|
}
|
|
9990
10260
|
}
|
|
@@ -10316,6 +10586,43 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
10316
10586
|
return true;
|
|
10317
10587
|
}
|
|
10318
10588
|
|
|
10589
|
+
function calcOldNewLineCount(lines) {
|
|
10590
|
+
var oldLines = 0;
|
|
10591
|
+
var newLines = 0;
|
|
10592
|
+
|
|
10593
|
+
lines.forEach(function (line) {
|
|
10594
|
+
if (typeof line !== 'string') {
|
|
10595
|
+
var myCount = calcOldNewLineCount(line.mine);
|
|
10596
|
+
var theirCount = calcOldNewLineCount(line.theirs);
|
|
10597
|
+
|
|
10598
|
+
if (oldLines !== undefined) {
|
|
10599
|
+
if (myCount.oldLines === theirCount.oldLines) {
|
|
10600
|
+
oldLines += myCount.oldLines;
|
|
10601
|
+
} else {
|
|
10602
|
+
oldLines = undefined;
|
|
10603
|
+
}
|
|
10604
|
+
}
|
|
10605
|
+
|
|
10606
|
+
if (newLines !== undefined) {
|
|
10607
|
+
if (myCount.newLines === theirCount.newLines) {
|
|
10608
|
+
newLines += myCount.newLines;
|
|
10609
|
+
} else {
|
|
10610
|
+
newLines = undefined;
|
|
10611
|
+
}
|
|
10612
|
+
}
|
|
10613
|
+
} else {
|
|
10614
|
+
if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
|
|
10615
|
+
newLines++;
|
|
10616
|
+
}
|
|
10617
|
+
if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
|
|
10618
|
+
oldLines++;
|
|
10619
|
+
}
|
|
10620
|
+
}
|
|
10621
|
+
});
|
|
10622
|
+
|
|
10623
|
+
return { oldLines: oldLines, newLines: newLines };
|
|
10624
|
+
}
|
|
10625
|
+
|
|
10319
10626
|
|
|
10320
10627
|
|
|
10321
10628
|
/***/ }),
|