|
1 | | -// mocha@10.8.2 in javascript ES2018 |
| 1 | +// mocha@11.1.0 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) : |
|
11652 | 11652 |
|
11653 | 11653 | return _breakCircularDeps(inputObj); |
11654 | 11654 | }; |
| 11655 | + |
| 11656 | + /** |
| 11657 | + * Checks if provided input can be parsed as a JavaScript Number. |
| 11658 | + */ |
| 11659 | + exports.isNumeric = input => { |
| 11660 | + return !isNaN(parseFloat(input)); |
| 11661 | + }; |
11655 | 11662 | }(utils$3)); |
11656 | 11663 |
|
11657 | 11664 | var _nodeResolve_empty = {}; |
|
13771 | 13778 | var hook = this._createHook(title, fn); |
13772 | 13779 | this._beforeAll.push(hook); |
13773 | 13780 | this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook); |
13774 | | - return this; |
| 13781 | + return hook; |
13775 | 13782 | }; |
13776 | 13783 |
|
13777 | 13784 | /** |
|
13795 | 13802 | var hook = this._createHook(title, fn); |
13796 | 13803 | this._afterAll.push(hook); |
13797 | 13804 | this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook); |
13798 | | - return this; |
| 13805 | + return hook; |
13799 | 13806 | }; |
13800 | 13807 |
|
13801 | 13808 | /** |
|
13819 | 13826 | var hook = this._createHook(title, fn); |
13820 | 13827 | this._beforeEach.push(hook); |
13821 | 13828 | this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook); |
13822 | | - return this; |
| 13829 | + return hook; |
13823 | 13830 | }; |
13824 | 13831 |
|
13825 | 13832 | /** |
|
13843 | 13850 | var hook = this._createHook(title, fn); |
13844 | 13851 | this._afterEach.push(hook); |
13845 | 13852 | this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook); |
13846 | | - return this; |
| 13853 | + return hook; |
13847 | 13854 | }; |
13848 | 13855 |
|
13849 | 13856 | /** |
@@ -15296,11 +15303,11 @@ |
15296 | 15303 | * @public |
15297 | 15304 | * @example |
15298 | 15305 | * // this reporter needs proper object references when run in parallel mode |
15299 | | - * class MyReporter() { |
| 15306 | + * class MyReporter { |
15300 | 15307 | * constructor(runner) { |
15301 | | - * this.runner.linkPartialObjects(true) |
| 15308 | + * runner.linkPartialObjects(true) |
15302 | 15309 | * .on(EVENT_SUITE_BEGIN, suite => { |
15303 | | - // this Suite may be the same object... |
| 15310 | + * // this Suite may be the same object... |
15304 | 15311 | * }) |
15305 | 15312 | * .on(EVENT_TEST_BEGIN, test => { |
15306 | 15313 | * // ...as the `test.parent` property |
|
18593 | 18600 | * @param {Function} fn |
18594 | 18601 | */ |
18595 | 18602 | before: function (name, fn) { |
18596 | | - suites[0].beforeAll(name, fn); |
| 18603 | + return suites[0].beforeAll(name, fn); |
18597 | 18604 | }, |
18598 | 18605 |
|
18599 | 18606 | /** |
|
18603 | 18610 | * @param {Function} fn |
18604 | 18611 | */ |
18605 | 18612 | after: function (name, fn) { |
18606 | | - suites[0].afterAll(name, fn); |
| 18613 | + return suites[0].afterAll(name, fn); |
18607 | 18614 | }, |
18608 | 18615 |
|
18609 | 18616 | /** |
|
18613 | 18620 | * @param {Function} fn |
18614 | 18621 | */ |
18615 | 18622 | beforeEach: function (name, fn) { |
18616 | | - suites[0].beforeEach(name, fn); |
| 18623 | + return suites[0].beforeEach(name, fn); |
18617 | 18624 | }, |
18618 | 18625 |
|
18619 | 18626 | /** |
|
18623 | 18630 | * @param {Function} fn |
18624 | 18631 | */ |
18625 | 18632 | afterEach: function (name, fn) { |
18626 | | - suites[0].afterEach(name, fn); |
| 18633 | + return suites[0].afterEach(name, fn); |
18627 | 18634 | }, |
18628 | 18635 |
|
18629 | 18636 | suite: { |
|
19201 | 19208 | }; |
19202 | 19209 |
|
19203 | 19210 | var name = "mocha"; |
19204 | | - var version = "10.8.2"; |
| 19211 | + var version = "11.1.0"; |
19205 | 19212 | var homepage = "https://mochajs.org/"; |
19206 | 19213 | var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png"; |
19207 | 19214 | var require$$17 = { |
|
19407 | 19414 | .ui(options.ui) |
19408 | 19415 | .reporter( |
19409 | 19416 | options.reporter, |
19410 | | - options.reporterOption || options.reporterOptions // for backwards compatibility |
| 19417 | + options['reporter-option'] || |
| 19418 | + options.reporterOption || |
| 19419 | + options.reporterOptions // for backwards compatibility |
19411 | 19420 | ) |
19412 | 19421 | .slow(options.slow) |
19413 | 19422 | .global(options.global); |
|
20548 | 20557 | /* eslint no-unused-vars: off */ |
20549 | 20558 | /* eslint-env commonjs */ |
20550 | 20559 |
|
| 20560 | + // https://qiita.com/yamadashy/items/86702dfb3c572b4c5514 |
| 20561 | + const setZeroTimeout = (function(global) { |
| 20562 | + const timeouts = []; |
| 20563 | + const messageName = "zero-timeout-message"; |
| 20564 | + |
| 20565 | + if (typeof global === 'undefined') return; |
| 20566 | + |
| 20567 | + function handleMessage(event) { |
| 20568 | + if (event.source == global && event.data == messageName) { |
| 20569 | + if (event.stopPropagation) { |
| 20570 | + event.stopPropagation(); |
| 20571 | + } |
| 20572 | + if (timeouts.length) { |
| 20573 | + timeouts.shift()(); |
| 20574 | + } |
| 20575 | + } |
| 20576 | + } |
| 20577 | + |
| 20578 | + if (global.postMessage) { |
| 20579 | + if (global.addEventListener) { |
| 20580 | + global.addEventListener("message", handleMessage, true); |
| 20581 | + } else if (global.attachEvent) { |
| 20582 | + global.attachEvent("onmessage", handleMessage); |
| 20583 | + } |
| 20584 | + |
| 20585 | + return function (fn) { |
| 20586 | + timeouts.push(fn); |
| 20587 | + global.postMessage(messageName, "*"); |
| 20588 | + } |
| 20589 | + } else { |
| 20590 | + return function () { |
| 20591 | + setTimeout$1(fn, 0); |
| 20592 | + } |
| 20593 | + } |
| 20594 | + }(window)); |
| 20595 | + |
20551 | 20596 | /** |
20552 | 20597 | * Shim process.stdout. |
20553 | 20598 | */ |
|
20645 | 20690 | immediateQueue.shift()(); |
20646 | 20691 | } |
20647 | 20692 | if (immediateQueue.length) { |
20648 | | - immediateTimeout = setTimeout$1(timeslice, 0); |
| 20693 | + immediateTimeout = setZeroTimeout(timeslice); |
20649 | 20694 | } else { |
20650 | 20695 | immediateTimeout = null; |
20651 | 20696 | } |
|
20658 | 20703 | Mocha.Runner.immediately = function (callback) { |
20659 | 20704 | immediateQueue.push(callback); |
20660 | 20705 | if (!immediateTimeout) { |
20661 | | - immediateTimeout = setTimeout$1(timeslice, 0); |
| 20706 | + immediateTimeout = setZeroTimeout(timeslice); |
20662 | 20707 | } |
20663 | 20708 | }; |
20664 | 20709 |
|
|
0 commit comments