mocha 9.1.2 → 9.1.3

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 CHANGED
@@ -1,3 +1,13 @@
1
+ # 9.1.3 / 2021-10-15
2
+
3
+ ## :bug: Fixes
4
+
5
+ - [#4769](https://github.com/mochajs/mocha/issues/4769): Browser: re-enable `bdd` ES6 style import ([**@juergba**](https://github.com/juergba))
6
+
7
+ ## :nut_and_bolt: Other
8
+
9
+ - [#4764](https://github.com/mochajs/mocha/issues/4764): Revert deprecation of `EVENT_SUITE_ADD_*` events ([**@beatfactor**](https://github.com/beatfactor))
10
+
1
11
  # 9.1.2 / 2021-09-25
2
12
 
3
13
  ## :bug: Fixes
package/browser-entry.js CHANGED
@@ -209,8 +209,18 @@ Mocha.process = process;
209
209
  /**
210
210
  * Expose mocha.
211
211
  */
212
-
213
212
  global.Mocha = Mocha;
214
213
  global.mocha = mocha;
215
214
 
215
+ // for bundlers: enable `import {describe, it} from 'mocha'`
216
+ // `bdd` interface only
217
+ // prettier-ignore
218
+ [
219
+ 'describe', 'context', 'it', 'specify',
220
+ 'xdescribe', 'xcontext', 'xit', 'xspecify',
221
+ 'before', 'beforeEach', 'afterEach', 'after'
222
+ ].forEach(function(key) {
223
+ mocha[key] = global[key];
224
+ });
225
+
216
226
  module.exports = mocha;
package/lib/suite.js CHANGED
@@ -10,7 +10,6 @@ var {
10
10
  assignNewMochaID,
11
11
  clamp,
12
12
  constants: utilsConstants,
13
- createMap,
14
13
  defineConstants,
15
14
  getMochaID,
16
15
  inherits,
@@ -92,16 +91,6 @@ function Suite(title, parentContext, isRoot) {
92
91
  });
93
92
 
94
93
  this.reset();
95
-
96
- this.on('newListener', function(event) {
97
- if (deprecatedEvents[event]) {
98
- errors.deprecate(
99
- 'Event "' +
100
- event +
101
- '" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
102
- );
103
- }
104
- });
105
94
  }
106
95
 
107
96
  /**
@@ -614,7 +603,7 @@ var constants = defineConstants(
614
603
  */
615
604
  {
616
605
  /**
617
- * Event emitted after a test file has been loaded Not emitted in browser.
606
+ * Event emitted after a test file has been loaded. Not emitted in browser.
618
607
  */
619
608
  EVENT_FILE_POST_REQUIRE: 'post-require',
620
609
  /**
@@ -626,70 +615,52 @@ var constants = defineConstants(
626
615
  */
627
616
  EVENT_FILE_REQUIRE: 'require',
628
617
  /**
629
- * Event emitted when `global.run()` is called (use with `delay` option)
618
+ * Event emitted when `global.run()` is called (use with `delay` option).
630
619
  */
631
620
  EVENT_ROOT_SUITE_RUN: 'run',
632
621
 
633
622
  /**
634
- * Namespace for collection of a `Suite`'s "after all" hooks
623
+ * Namespace for collection of a `Suite`'s "after all" hooks.
635
624
  */
636
625
  HOOK_TYPE_AFTER_ALL: 'afterAll',
637
626
  /**
638
- * Namespace for collection of a `Suite`'s "after each" hooks
627
+ * Namespace for collection of a `Suite`'s "after each" hooks.
639
628
  */
640
629
  HOOK_TYPE_AFTER_EACH: 'afterEach',
641
630
  /**
642
- * Namespace for collection of a `Suite`'s "before all" hooks
631
+ * Namespace for collection of a `Suite`'s "before all" hooks.
643
632
  */
644
633
  HOOK_TYPE_BEFORE_ALL: 'beforeAll',
645
634
  /**
646
- * Namespace for collection of a `Suite`'s "before all" hooks
635
+ * Namespace for collection of a `Suite`'s "before each" hooks.
647
636
  */
648
637
  HOOK_TYPE_BEFORE_EACH: 'beforeEach',
649
638
 
650
- // the following events are all deprecated
651
-
652
639
  /**
653
- * Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
640
+ * Emitted after a child `Suite` has been added to a `Suite`.
641
+ */
642
+ EVENT_SUITE_ADD_SUITE: 'suite',
643
+ /**
644
+ * Emitted after an "after all" `Hook` has been added to a `Suite`.
654
645
  */
655
646
  EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
656
647
  /**
657
- * Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
648
+ * Emitted after an "after each" `Hook` has been added to a `Suite`.
658
649
  */
659
650
  EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
660
651
  /**
661
- * Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
652
+ * Emitted after an "before all" `Hook` has been added to a `Suite`.
662
653
  */
663
654
  EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
664
655
  /**
665
- * Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
656
+ * Emitted after an "before each" `Hook` has been added to a `Suite`.
666
657
  */
667
658
  EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
668
659
  /**
669
- * Emitted after a child `Suite` has been added to a `Suite`. Deprecated
670
- */
671
- EVENT_SUITE_ADD_SUITE: 'suite',
672
- /**
673
- * Emitted after a `Test` has been added to a `Suite`. Deprecated
660
+ * Emitted after a `Test` has been added to a `Suite`.
674
661
  */
675
662
  EVENT_SUITE_ADD_TEST: 'test'
676
663
  }
677
664
  );
678
665
 
679
- /**
680
- * @summary There are no known use cases for these events.
681
- * @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
682
- * @todo Remove eventually
683
- * @type {Object<string,boolean>}
684
- * @ignore
685
- */
686
- var deprecatedEvents = Object.keys(constants)
687
- .filter(function(constant) {
688
- return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
689
- })
690
- .reduce(function(acc, constant) {
691
- acc[constants[constant]] = true;
692
- return acc;
693
- }, createMap());
694
-
695
666
  Suite.constants = constants;
package/mocha-es2018.js CHANGED
@@ -1,4 +1,4 @@
1
- // mocha@9.1.2 in javascript ES2018
1
+ // mocha@9.1.3 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) :
@@ -12307,7 +12307,6 @@
12307
12307
  assignNewMochaID,
12308
12308
  clamp,
12309
12309
  constants: utilsConstants,
12310
- createMap,
12311
12310
  defineConstants,
12312
12311
  getMochaID,
12313
12312
  inherits,
@@ -12389,16 +12388,6 @@
12389
12388
  });
12390
12389
 
12391
12390
  this.reset();
12392
-
12393
- this.on('newListener', function(event) {
12394
- if (deprecatedEvents[event]) {
12395
- errors.deprecate(
12396
- 'Event "' +
12397
- event +
12398
- '" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
12399
- );
12400
- }
12401
- });
12402
12391
  }
12403
12392
 
12404
12393
  /**
@@ -12911,7 +12900,7 @@
12911
12900
  */
12912
12901
  {
12913
12902
  /**
12914
- * Event emitted after a test file has been loaded Not emitted in browser.
12903
+ * Event emitted after a test file has been loaded. Not emitted in browser.
12915
12904
  */
12916
12905
  EVENT_FILE_POST_REQUIRE: 'post-require',
12917
12906
  /**
@@ -12923,72 +12912,54 @@
12923
12912
  */
12924
12913
  EVENT_FILE_REQUIRE: 'require',
12925
12914
  /**
12926
- * Event emitted when `global.run()` is called (use with `delay` option)
12915
+ * Event emitted when `global.run()` is called (use with `delay` option).
12927
12916
  */
12928
12917
  EVENT_ROOT_SUITE_RUN: 'run',
12929
12918
 
12930
12919
  /**
12931
- * Namespace for collection of a `Suite`'s "after all" hooks
12920
+ * Namespace for collection of a `Suite`'s "after all" hooks.
12932
12921
  */
12933
12922
  HOOK_TYPE_AFTER_ALL: 'afterAll',
12934
12923
  /**
12935
- * Namespace for collection of a `Suite`'s "after each" hooks
12924
+ * Namespace for collection of a `Suite`'s "after each" hooks.
12936
12925
  */
12937
12926
  HOOK_TYPE_AFTER_EACH: 'afterEach',
12938
12927
  /**
12939
- * Namespace for collection of a `Suite`'s "before all" hooks
12928
+ * Namespace for collection of a `Suite`'s "before all" hooks.
12940
12929
  */
12941
12930
  HOOK_TYPE_BEFORE_ALL: 'beforeAll',
12942
12931
  /**
12943
- * Namespace for collection of a `Suite`'s "before all" hooks
12932
+ * Namespace for collection of a `Suite`'s "before each" hooks.
12944
12933
  */
12945
12934
  HOOK_TYPE_BEFORE_EACH: 'beforeEach',
12946
12935
 
12947
- // the following events are all deprecated
12948
-
12949
12936
  /**
12950
- * Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
12937
+ * Emitted after a child `Suite` has been added to a `Suite`.
12938
+ */
12939
+ EVENT_SUITE_ADD_SUITE: 'suite',
12940
+ /**
12941
+ * Emitted after an "after all" `Hook` has been added to a `Suite`.
12951
12942
  */
12952
12943
  EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
12953
12944
  /**
12954
- * Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
12945
+ * Emitted after an "after each" `Hook` has been added to a `Suite`.
12955
12946
  */
12956
12947
  EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
12957
12948
  /**
12958
- * Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
12949
+ * Emitted after an "before all" `Hook` has been added to a `Suite`.
12959
12950
  */
12960
12951
  EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
12961
12952
  /**
12962
- * Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
12953
+ * Emitted after an "before each" `Hook` has been added to a `Suite`.
12963
12954
  */
12964
12955
  EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
12965
12956
  /**
12966
- * Emitted after a child `Suite` has been added to a `Suite`. Deprecated
12967
- */
12968
- EVENT_SUITE_ADD_SUITE: 'suite',
12969
- /**
12970
- * Emitted after a `Test` has been added to a `Suite`. Deprecated
12957
+ * Emitted after a `Test` has been added to a `Suite`.
12971
12958
  */
12972
12959
  EVENT_SUITE_ADD_TEST: 'test'
12973
12960
  }
12974
12961
  );
12975
12962
 
12976
- /**
12977
- * @summary There are no known use cases for these events.
12978
- * @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
12979
- * @todo Remove eventually
12980
- * @type {Object<string,boolean>}
12981
- * @ignore
12982
- */
12983
- var deprecatedEvents = Object.keys(constants)
12984
- .filter(function(constant) {
12985
- return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
12986
- })
12987
- .reduce(function(acc, constant) {
12988
- acc[constants[constant]] = true;
12989
- return acc;
12990
- }, createMap());
12991
-
12992
12963
  Suite.constants = constants;
12993
12964
  });
12994
12965
 
@@ -17137,7 +17108,7 @@
17137
17108
  });
17138
17109
 
17139
17110
  var name = "mocha";
17140
- var version = "9.1.2";
17111
+ var version = "9.1.3";
17141
17112
  var homepage = "https://mochajs.org/";
17142
17113
  var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
17143
17114
  var _package = {
@@ -19805,10 +19776,20 @@
19805
19776
  /**
19806
19777
  * Expose mocha.
19807
19778
  */
19808
-
19809
19779
  commonjsGlobal.Mocha = mocha$1;
19810
19780
  commonjsGlobal.mocha = mocha;
19811
19781
 
19782
+ // for bundlers: enable `import {describe, it} from 'mocha'`
19783
+ // `bdd` interface only
19784
+ // prettier-ignore
19785
+ [
19786
+ 'describe', 'context', 'it', 'specify',
19787
+ 'xdescribe', 'xcontext', 'xit', 'xspecify',
19788
+ 'before', 'beforeEach', 'afterEach', 'after'
19789
+ ].forEach(function(key) {
19790
+ mocha[key] = commonjsGlobal[key];
19791
+ });
19792
+
19812
19793
  var browserEntry = mocha;
19813
19794
 
19814
19795
  return browserEntry;
package/mocha.js CHANGED
@@ -1,4 +1,4 @@
1
- // mocha@9.1.2 transpiled to javascript ES5
1
+ // mocha@9.1.3 transpiled to javascript ES5
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) :
@@ -23026,7 +23026,6 @@
23026
23026
  var assignNewMochaID = utils.assignNewMochaID,
23027
23027
  clamp = utils.clamp,
23028
23028
  utilsConstants = utils.constants,
23029
- createMap = utils.createMap,
23030
23029
  defineConstants = utils.defineConstants,
23031
23030
  getMochaID = utils.getMochaID,
23032
23031
  inherits = utils.inherits,
@@ -23099,11 +23098,6 @@
23099
23098
  }
23100
23099
  });
23101
23100
  this.reset();
23102
- this.on('newListener', function (event) {
23103
- if (deprecatedEvents[event]) {
23104
- errors.deprecate('Event "' + event + '" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm');
23105
- }
23106
- });
23107
23101
  }
23108
23102
  /**
23109
23103
  * Inherit from `EventEmitter.prototype`.
@@ -23670,7 +23664,7 @@
23670
23664
  */
23671
23665
  {
23672
23666
  /**
23673
- * Event emitted after a test file has been loaded Not emitted in browser.
23667
+ * Event emitted after a test file has been loaded. Not emitted in browser.
23674
23668
  */
23675
23669
  EVENT_FILE_POST_REQUIRE: 'post-require',
23676
23670
 
@@ -23685,75 +23679,60 @@
23685
23679
  EVENT_FILE_REQUIRE: 'require',
23686
23680
 
23687
23681
  /**
23688
- * Event emitted when `global.run()` is called (use with `delay` option)
23682
+ * Event emitted when `global.run()` is called (use with `delay` option).
23689
23683
  */
23690
23684
  EVENT_ROOT_SUITE_RUN: 'run',
23691
23685
 
23692
23686
  /**
23693
- * Namespace for collection of a `Suite`'s "after all" hooks
23687
+ * Namespace for collection of a `Suite`'s "after all" hooks.
23694
23688
  */
23695
23689
  HOOK_TYPE_AFTER_ALL: 'afterAll',
23696
23690
 
23697
23691
  /**
23698
- * Namespace for collection of a `Suite`'s "after each" hooks
23692
+ * Namespace for collection of a `Suite`'s "after each" hooks.
23699
23693
  */
23700
23694
  HOOK_TYPE_AFTER_EACH: 'afterEach',
23701
23695
 
23702
23696
  /**
23703
- * Namespace for collection of a `Suite`'s "before all" hooks
23697
+ * Namespace for collection of a `Suite`'s "before all" hooks.
23704
23698
  */
23705
23699
  HOOK_TYPE_BEFORE_ALL: 'beforeAll',
23706
23700
 
23707
23701
  /**
23708
- * Namespace for collection of a `Suite`'s "before all" hooks
23702
+ * Namespace for collection of a `Suite`'s "before each" hooks.
23709
23703
  */
23710
23704
  HOOK_TYPE_BEFORE_EACH: 'beforeEach',
23711
- // the following events are all deprecated
23712
23705
 
23713
23706
  /**
23714
- * Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
23707
+ * Emitted after a child `Suite` has been added to a `Suite`.
23708
+ */
23709
+ EVENT_SUITE_ADD_SUITE: 'suite',
23710
+
23711
+ /**
23712
+ * Emitted after an "after all" `Hook` has been added to a `Suite`.
23715
23713
  */
23716
23714
  EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
23717
23715
 
23718
23716
  /**
23719
- * Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
23717
+ * Emitted after an "after each" `Hook` has been added to a `Suite`.
23720
23718
  */
23721
23719
  EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
23722
23720
 
23723
23721
  /**
23724
- * Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
23722
+ * Emitted after an "before all" `Hook` has been added to a `Suite`.
23725
23723
  */
23726
23724
  EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
23727
23725
 
23728
23726
  /**
23729
- * Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
23727
+ * Emitted after an "before each" `Hook` has been added to a `Suite`.
23730
23728
  */
23731
23729
  EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
23732
23730
 
23733
23731
  /**
23734
- * Emitted after a child `Suite` has been added to a `Suite`. Deprecated
23735
- */
23736
- EVENT_SUITE_ADD_SUITE: 'suite',
23737
-
23738
- /**
23739
- * Emitted after a `Test` has been added to a `Suite`. Deprecated
23732
+ * Emitted after a `Test` has been added to a `Suite`.
23740
23733
  */
23741
23734
  EVENT_SUITE_ADD_TEST: 'test'
23742
23735
  });
23743
- /**
23744
- * @summary There are no known use cases for these events.
23745
- * @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
23746
- * @todo Remove eventually
23747
- * @type {Object<string,boolean>}
23748
- * @ignore
23749
- */
23750
-
23751
- var deprecatedEvents = Object.keys(constants).filter(function (constant) {
23752
- return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
23753
- }).reduce(function (acc, constant) {
23754
- acc[constants[constant]] = true;
23755
- return acc;
23756
- }, createMap());
23757
23736
  Suite.constants = constants;
23758
23737
  });
23759
23738
 
@@ -27927,7 +27906,7 @@
27927
27906
  });
27928
27907
 
27929
27908
  var name = "mocha";
27930
- var version = "9.1.2";
27909
+ var version = "9.1.3";
27931
27910
  var homepage = "https://mochajs.org/";
27932
27911
  var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
27933
27912
  var _package = {
@@ -30835,7 +30814,13 @@
30835
30814
  */
30836
30815
 
30837
30816
  commonjsGlobal.Mocha = mocha$1;
30838
- commonjsGlobal.mocha = mocha;
30817
+ commonjsGlobal.mocha = mocha; // for bundlers: enable `import {describe, it} from 'mocha'`
30818
+ // `bdd` interface only
30819
+ // prettier-ignore
30820
+
30821
+ ['describe', 'context', 'it', 'specify', 'xdescribe', 'xcontext', 'xit', 'xspecify', 'before', 'beforeEach', 'afterEach', 'after'].forEach(function (key) {
30822
+ mocha[key] = commonjsGlobal[key];
30823
+ });
30839
30824
  var browserEntry = mocha;
30840
30825
 
30841
30826
  return browserEntry;