mocha 9.1.2

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +1015 -0
  2. package/LICENSE +22 -0
  3. package/README.md +70 -0
  4. package/assets/growl/error.png +0 -0
  5. package/assets/growl/ok.png +0 -0
  6. package/bin/_mocha +10 -0
  7. package/bin/mocha +142 -0
  8. package/browser-entry.js +216 -0
  9. package/index.js +3 -0
  10. package/lib/browser/growl.js +169 -0
  11. package/lib/browser/highlight-tags.js +39 -0
  12. package/lib/browser/parse-query.js +24 -0
  13. package/lib/browser/progress.js +123 -0
  14. package/lib/browser/template.html +20 -0
  15. package/lib/cli/cli.js +89 -0
  16. package/lib/cli/collect-files.js +92 -0
  17. package/lib/cli/commands.js +13 -0
  18. package/lib/cli/config.js +105 -0
  19. package/lib/cli/index.js +3 -0
  20. package/lib/cli/init.js +36 -0
  21. package/lib/cli/lookup-files.js +145 -0
  22. package/lib/cli/node-flags.js +85 -0
  23. package/lib/cli/one-and-dones.js +69 -0
  24. package/lib/cli/options.js +261 -0
  25. package/lib/cli/run-helpers.js +243 -0
  26. package/lib/cli/run-option-metadata.js +117 -0
  27. package/lib/cli/run.js +379 -0
  28. package/lib/cli/watch-run.js +380 -0
  29. package/lib/context.js +86 -0
  30. package/lib/errors.js +563 -0
  31. package/lib/hook.js +89 -0
  32. package/lib/interfaces/bdd.js +111 -0
  33. package/lib/interfaces/common.js +193 -0
  34. package/lib/interfaces/exports.js +60 -0
  35. package/lib/interfaces/index.js +6 -0
  36. package/lib/interfaces/qunit.js +98 -0
  37. package/lib/interfaces/tdd.js +106 -0
  38. package/lib/mocha.js +1374 -0
  39. package/lib/mocharc.json +10 -0
  40. package/lib/nodejs/buffered-worker-pool.js +172 -0
  41. package/lib/nodejs/esm-utils.js +109 -0
  42. package/lib/nodejs/file-unloader.js +15 -0
  43. package/lib/nodejs/growl.js +137 -0
  44. package/lib/nodejs/parallel-buffered-runner.js +433 -0
  45. package/lib/nodejs/reporters/parallel-buffered.js +165 -0
  46. package/lib/nodejs/serializer.js +412 -0
  47. package/lib/nodejs/worker.js +151 -0
  48. package/lib/pending.js +16 -0
  49. package/lib/plugin-loader.js +286 -0
  50. package/lib/reporters/base.js +537 -0
  51. package/lib/reporters/doc.js +95 -0
  52. package/lib/reporters/dot.js +81 -0
  53. package/lib/reporters/html.js +390 -0
  54. package/lib/reporters/index.js +19 -0
  55. package/lib/reporters/json-stream.js +92 -0
  56. package/lib/reporters/json.js +162 -0
  57. package/lib/reporters/landing.js +116 -0
  58. package/lib/reporters/list.js +78 -0
  59. package/lib/reporters/markdown.js +112 -0
  60. package/lib/reporters/min.js +52 -0
  61. package/lib/reporters/nyan.js +276 -0
  62. package/lib/reporters/progress.js +104 -0
  63. package/lib/reporters/spec.js +99 -0
  64. package/lib/reporters/tap.js +293 -0
  65. package/lib/reporters/xunit.js +217 -0
  66. package/lib/runnable.js +476 -0
  67. package/lib/runner.js +1269 -0
  68. package/lib/stats-collector.js +83 -0
  69. package/lib/suite.js +695 -0
  70. package/lib/test.js +113 -0
  71. package/lib/utils.js +641 -0
  72. package/mocha-es2018.js +19816 -0
  73. package/mocha.css +325 -0
  74. package/mocha.js +30844 -0
  75. package/mocha.js.map +1 -0
  76. package/package.json +200 -0
package/lib/suite.js ADDED
@@ -0,0 +1,695 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Module dependencies.
5
+ * @private
6
+ */
7
+ const {EventEmitter} = require('events');
8
+ const Hook = require('./hook');
9
+ var {
10
+ assignNewMochaID,
11
+ clamp,
12
+ constants: utilsConstants,
13
+ createMap,
14
+ defineConstants,
15
+ getMochaID,
16
+ inherits,
17
+ isString
18
+ } = require('./utils');
19
+ const debug = require('debug')('mocha:suite');
20
+ const milliseconds = require('ms');
21
+ const errors = require('./errors');
22
+
23
+ const {MOCHA_ID_PROP_NAME} = utilsConstants;
24
+
25
+ /**
26
+ * Expose `Suite`.
27
+ */
28
+
29
+ exports = module.exports = Suite;
30
+
31
+ /**
32
+ * Create a new `Suite` with the given `title` and parent `Suite`.
33
+ *
34
+ * @public
35
+ * @param {Suite} parent - Parent suite (required!)
36
+ * @param {string} title - Title
37
+ * @return {Suite}
38
+ */
39
+ Suite.create = function(parent, title) {
40
+ var suite = new Suite(title, parent.ctx);
41
+ suite.parent = parent;
42
+ title = suite.fullTitle();
43
+ parent.addSuite(suite);
44
+ return suite;
45
+ };
46
+
47
+ /**
48
+ * Constructs a new `Suite` instance with the given `title`, `ctx`, and `isRoot`.
49
+ *
50
+ * @public
51
+ * @class
52
+ * @extends EventEmitter
53
+ * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter|EventEmitter}
54
+ * @param {string} title - Suite title.
55
+ * @param {Context} parentContext - Parent context instance.
56
+ * @param {boolean} [isRoot=false] - Whether this is the root suite.
57
+ */
58
+ function Suite(title, parentContext, isRoot) {
59
+ if (!isString(title)) {
60
+ throw errors.createInvalidArgumentTypeError(
61
+ 'Suite argument "title" must be a string. Received type "' +
62
+ typeof title +
63
+ '"',
64
+ 'title',
65
+ 'string'
66
+ );
67
+ }
68
+ this.title = title;
69
+ function Context() {}
70
+ Context.prototype = parentContext;
71
+ this.ctx = new Context();
72
+ this.suites = [];
73
+ this.tests = [];
74
+ this.root = isRoot === true;
75
+ this.pending = false;
76
+ this._retries = -1;
77
+ this._beforeEach = [];
78
+ this._beforeAll = [];
79
+ this._afterEach = [];
80
+ this._afterAll = [];
81
+ this._timeout = 2000;
82
+ this._slow = 75;
83
+ this._bail = false;
84
+ this._onlyTests = [];
85
+ this._onlySuites = [];
86
+ assignNewMochaID(this);
87
+
88
+ Object.defineProperty(this, 'id', {
89
+ get() {
90
+ return getMochaID(this);
91
+ }
92
+ });
93
+
94
+ 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
+ }
106
+
107
+ /**
108
+ * Inherit from `EventEmitter.prototype`.
109
+ */
110
+ inherits(Suite, EventEmitter);
111
+
112
+ /**
113
+ * Resets the state initially or for a next run.
114
+ */
115
+ Suite.prototype.reset = function() {
116
+ this.delayed = false;
117
+ function doReset(thingToReset) {
118
+ thingToReset.reset();
119
+ }
120
+ this.suites.forEach(doReset);
121
+ this.tests.forEach(doReset);
122
+ this._beforeEach.forEach(doReset);
123
+ this._afterEach.forEach(doReset);
124
+ this._beforeAll.forEach(doReset);
125
+ this._afterAll.forEach(doReset);
126
+ };
127
+
128
+ /**
129
+ * Return a clone of this `Suite`.
130
+ *
131
+ * @private
132
+ * @return {Suite}
133
+ */
134
+ Suite.prototype.clone = function() {
135
+ var suite = new Suite(this.title);
136
+ debug('clone');
137
+ suite.ctx = this.ctx;
138
+ suite.root = this.root;
139
+ suite.timeout(this.timeout());
140
+ suite.retries(this.retries());
141
+ suite.slow(this.slow());
142
+ suite.bail(this.bail());
143
+ return suite;
144
+ };
145
+
146
+ /**
147
+ * Set or get timeout `ms` or short-hand such as "2s".
148
+ *
149
+ * @private
150
+ * @todo Do not attempt to set value if `ms` is undefined
151
+ * @param {number|string} ms
152
+ * @return {Suite|number} for chaining
153
+ */
154
+ Suite.prototype.timeout = function(ms) {
155
+ if (!arguments.length) {
156
+ return this._timeout;
157
+ }
158
+ if (typeof ms === 'string') {
159
+ ms = milliseconds(ms);
160
+ }
161
+
162
+ // Clamp to range
163
+ var INT_MAX = Math.pow(2, 31) - 1;
164
+ var range = [0, INT_MAX];
165
+ ms = clamp(ms, range);
166
+
167
+ debug('timeout %d', ms);
168
+ this._timeout = parseInt(ms, 10);
169
+ return this;
170
+ };
171
+
172
+ /**
173
+ * Set or get number of times to retry a failed test.
174
+ *
175
+ * @private
176
+ * @param {number|string} n
177
+ * @return {Suite|number} for chaining
178
+ */
179
+ Suite.prototype.retries = function(n) {
180
+ if (!arguments.length) {
181
+ return this._retries;
182
+ }
183
+ debug('retries %d', n);
184
+ this._retries = parseInt(n, 10) || 0;
185
+ return this;
186
+ };
187
+
188
+ /**
189
+ * Set or get slow `ms` or short-hand such as "2s".
190
+ *
191
+ * @private
192
+ * @param {number|string} ms
193
+ * @return {Suite|number} for chaining
194
+ */
195
+ Suite.prototype.slow = function(ms) {
196
+ if (!arguments.length) {
197
+ return this._slow;
198
+ }
199
+ if (typeof ms === 'string') {
200
+ ms = milliseconds(ms);
201
+ }
202
+ debug('slow %d', ms);
203
+ this._slow = ms;
204
+ return this;
205
+ };
206
+
207
+ /**
208
+ * Set or get whether to bail after first error.
209
+ *
210
+ * @private
211
+ * @param {boolean} bail
212
+ * @return {Suite|number} for chaining
213
+ */
214
+ Suite.prototype.bail = function(bail) {
215
+ if (!arguments.length) {
216
+ return this._bail;
217
+ }
218
+ debug('bail %s', bail);
219
+ this._bail = bail;
220
+ return this;
221
+ };
222
+
223
+ /**
224
+ * Check if this suite or its parent suite is marked as pending.
225
+ *
226
+ * @private
227
+ */
228
+ Suite.prototype.isPending = function() {
229
+ return this.pending || (this.parent && this.parent.isPending());
230
+ };
231
+
232
+ /**
233
+ * Generic hook-creator.
234
+ * @private
235
+ * @param {string} title - Title of hook
236
+ * @param {Function} fn - Hook callback
237
+ * @returns {Hook} A new hook
238
+ */
239
+ Suite.prototype._createHook = function(title, fn) {
240
+ var hook = new Hook(title, fn);
241
+ hook.parent = this;
242
+ hook.timeout(this.timeout());
243
+ hook.retries(this.retries());
244
+ hook.slow(this.slow());
245
+ hook.ctx = this.ctx;
246
+ hook.file = this.file;
247
+ return hook;
248
+ };
249
+
250
+ /**
251
+ * Run `fn(test[, done])` before running tests.
252
+ *
253
+ * @private
254
+ * @param {string} title
255
+ * @param {Function} fn
256
+ * @return {Suite} for chaining
257
+ */
258
+ Suite.prototype.beforeAll = function(title, fn) {
259
+ if (this.isPending()) {
260
+ return this;
261
+ }
262
+ if (typeof title === 'function') {
263
+ fn = title;
264
+ title = fn.name;
265
+ }
266
+ title = '"before all" hook' + (title ? ': ' + title : '');
267
+
268
+ var hook = this._createHook(title, fn);
269
+ this._beforeAll.push(hook);
270
+ this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook);
271
+ return this;
272
+ };
273
+
274
+ /**
275
+ * Run `fn(test[, done])` after running tests.
276
+ *
277
+ * @private
278
+ * @param {string} title
279
+ * @param {Function} fn
280
+ * @return {Suite} for chaining
281
+ */
282
+ Suite.prototype.afterAll = function(title, fn) {
283
+ if (this.isPending()) {
284
+ return this;
285
+ }
286
+ if (typeof title === 'function') {
287
+ fn = title;
288
+ title = fn.name;
289
+ }
290
+ title = '"after all" hook' + (title ? ': ' + title : '');
291
+
292
+ var hook = this._createHook(title, fn);
293
+ this._afterAll.push(hook);
294
+ this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook);
295
+ return this;
296
+ };
297
+
298
+ /**
299
+ * Run `fn(test[, done])` before each test case.
300
+ *
301
+ * @private
302
+ * @param {string} title
303
+ * @param {Function} fn
304
+ * @return {Suite} for chaining
305
+ */
306
+ Suite.prototype.beforeEach = function(title, fn) {
307
+ if (this.isPending()) {
308
+ return this;
309
+ }
310
+ if (typeof title === 'function') {
311
+ fn = title;
312
+ title = fn.name;
313
+ }
314
+ title = '"before each" hook' + (title ? ': ' + title : '');
315
+
316
+ var hook = this._createHook(title, fn);
317
+ this._beforeEach.push(hook);
318
+ this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook);
319
+ return this;
320
+ };
321
+
322
+ /**
323
+ * Run `fn(test[, done])` after each test case.
324
+ *
325
+ * @private
326
+ * @param {string} title
327
+ * @param {Function} fn
328
+ * @return {Suite} for chaining
329
+ */
330
+ Suite.prototype.afterEach = function(title, fn) {
331
+ if (this.isPending()) {
332
+ return this;
333
+ }
334
+ if (typeof title === 'function') {
335
+ fn = title;
336
+ title = fn.name;
337
+ }
338
+ title = '"after each" hook' + (title ? ': ' + title : '');
339
+
340
+ var hook = this._createHook(title, fn);
341
+ this._afterEach.push(hook);
342
+ this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook);
343
+ return this;
344
+ };
345
+
346
+ /**
347
+ * Add a test `suite`.
348
+ *
349
+ * @private
350
+ * @param {Suite} suite
351
+ * @return {Suite} for chaining
352
+ */
353
+ Suite.prototype.addSuite = function(suite) {
354
+ suite.parent = this;
355
+ suite.root = false;
356
+ suite.timeout(this.timeout());
357
+ suite.retries(this.retries());
358
+ suite.slow(this.slow());
359
+ suite.bail(this.bail());
360
+ this.suites.push(suite);
361
+ this.emit(constants.EVENT_SUITE_ADD_SUITE, suite);
362
+ return this;
363
+ };
364
+
365
+ /**
366
+ * Add a `test` to this suite.
367
+ *
368
+ * @private
369
+ * @param {Test} test
370
+ * @return {Suite} for chaining
371
+ */
372
+ Suite.prototype.addTest = function(test) {
373
+ test.parent = this;
374
+ test.timeout(this.timeout());
375
+ test.retries(this.retries());
376
+ test.slow(this.slow());
377
+ test.ctx = this.ctx;
378
+ this.tests.push(test);
379
+ this.emit(constants.EVENT_SUITE_ADD_TEST, test);
380
+ return this;
381
+ };
382
+
383
+ /**
384
+ * Return the full title generated by recursively concatenating the parent's
385
+ * full title.
386
+ *
387
+ * @memberof Suite
388
+ * @public
389
+ * @return {string}
390
+ */
391
+ Suite.prototype.fullTitle = function() {
392
+ return this.titlePath().join(' ');
393
+ };
394
+
395
+ /**
396
+ * Return the title path generated by recursively concatenating the parent's
397
+ * title path.
398
+ *
399
+ * @memberof Suite
400
+ * @public
401
+ * @return {string}
402
+ */
403
+ Suite.prototype.titlePath = function() {
404
+ var result = [];
405
+ if (this.parent) {
406
+ result = result.concat(this.parent.titlePath());
407
+ }
408
+ if (!this.root) {
409
+ result.push(this.title);
410
+ }
411
+ return result;
412
+ };
413
+
414
+ /**
415
+ * Return the total number of tests.
416
+ *
417
+ * @memberof Suite
418
+ * @public
419
+ * @return {number}
420
+ */
421
+ Suite.prototype.total = function() {
422
+ return (
423
+ this.suites.reduce(function(sum, suite) {
424
+ return sum + suite.total();
425
+ }, 0) + this.tests.length
426
+ );
427
+ };
428
+
429
+ /**
430
+ * Iterates through each suite recursively to find all tests. Applies a
431
+ * function in the format `fn(test)`.
432
+ *
433
+ * @private
434
+ * @param {Function} fn
435
+ * @return {Suite}
436
+ */
437
+ Suite.prototype.eachTest = function(fn) {
438
+ this.tests.forEach(fn);
439
+ this.suites.forEach(function(suite) {
440
+ suite.eachTest(fn);
441
+ });
442
+ return this;
443
+ };
444
+
445
+ /**
446
+ * This will run the root suite if we happen to be running in delayed mode.
447
+ * @private
448
+ */
449
+ Suite.prototype.run = function run() {
450
+ if (this.root) {
451
+ this.emit(constants.EVENT_ROOT_SUITE_RUN);
452
+ }
453
+ };
454
+
455
+ /**
456
+ * Determines whether a suite has an `only` test or suite as a descendant.
457
+ *
458
+ * @private
459
+ * @returns {Boolean}
460
+ */
461
+ Suite.prototype.hasOnly = function hasOnly() {
462
+ return (
463
+ this._onlyTests.length > 0 ||
464
+ this._onlySuites.length > 0 ||
465
+ this.suites.some(function(suite) {
466
+ return suite.hasOnly();
467
+ })
468
+ );
469
+ };
470
+
471
+ /**
472
+ * Filter suites based on `isOnly` logic.
473
+ *
474
+ * @private
475
+ * @returns {Boolean}
476
+ */
477
+ Suite.prototype.filterOnly = function filterOnly() {
478
+ if (this._onlyTests.length) {
479
+ // If the suite contains `only` tests, run those and ignore any nested suites.
480
+ this.tests = this._onlyTests;
481
+ this.suites = [];
482
+ } else {
483
+ // Otherwise, do not run any of the tests in this suite.
484
+ this.tests = [];
485
+ this._onlySuites.forEach(function(onlySuite) {
486
+ // If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
487
+ // Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
488
+ if (onlySuite.hasOnly()) {
489
+ onlySuite.filterOnly();
490
+ }
491
+ });
492
+ // Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
493
+ var onlySuites = this._onlySuites;
494
+ this.suites = this.suites.filter(function(childSuite) {
495
+ return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
496
+ });
497
+ }
498
+ // Keep the suite only if there is something to run
499
+ return this.tests.length > 0 || this.suites.length > 0;
500
+ };
501
+
502
+ /**
503
+ * Adds a suite to the list of subsuites marked `only`.
504
+ *
505
+ * @private
506
+ * @param {Suite} suite
507
+ */
508
+ Suite.prototype.appendOnlySuite = function(suite) {
509
+ this._onlySuites.push(suite);
510
+ };
511
+
512
+ /**
513
+ * Marks a suite to be `only`.
514
+ *
515
+ * @private
516
+ */
517
+ Suite.prototype.markOnly = function() {
518
+ this.parent && this.parent.appendOnlySuite(this);
519
+ };
520
+
521
+ /**
522
+ * Adds a test to the list of tests marked `only`.
523
+ *
524
+ * @private
525
+ * @param {Test} test
526
+ */
527
+ Suite.prototype.appendOnlyTest = function(test) {
528
+ this._onlyTests.push(test);
529
+ };
530
+
531
+ /**
532
+ * Returns the array of hooks by hook name; see `HOOK_TYPE_*` constants.
533
+ * @private
534
+ */
535
+ Suite.prototype.getHooks = function getHooks(name) {
536
+ return this['_' + name];
537
+ };
538
+
539
+ /**
540
+ * cleans all references from this suite and all child suites.
541
+ */
542
+ Suite.prototype.dispose = function() {
543
+ this.suites.forEach(function(suite) {
544
+ suite.dispose();
545
+ });
546
+ this.cleanReferences();
547
+ };
548
+
549
+ /**
550
+ * Cleans up the references to all the deferred functions
551
+ * (before/after/beforeEach/afterEach) and tests of a Suite.
552
+ * These must be deleted otherwise a memory leak can happen,
553
+ * as those functions may reference variables from closures,
554
+ * thus those variables can never be garbage collected as long
555
+ * as the deferred functions exist.
556
+ *
557
+ * @private
558
+ */
559
+ Suite.prototype.cleanReferences = function cleanReferences() {
560
+ function cleanArrReferences(arr) {
561
+ for (var i = 0; i < arr.length; i++) {
562
+ delete arr[i].fn;
563
+ }
564
+ }
565
+
566
+ if (Array.isArray(this._beforeAll)) {
567
+ cleanArrReferences(this._beforeAll);
568
+ }
569
+
570
+ if (Array.isArray(this._beforeEach)) {
571
+ cleanArrReferences(this._beforeEach);
572
+ }
573
+
574
+ if (Array.isArray(this._afterAll)) {
575
+ cleanArrReferences(this._afterAll);
576
+ }
577
+
578
+ if (Array.isArray(this._afterEach)) {
579
+ cleanArrReferences(this._afterEach);
580
+ }
581
+
582
+ for (var i = 0; i < this.tests.length; i++) {
583
+ delete this.tests[i].fn;
584
+ }
585
+ };
586
+
587
+ /**
588
+ * Returns an object suitable for IPC.
589
+ * Functions are represented by keys beginning with `$$`.
590
+ * @private
591
+ * @returns {Object}
592
+ */
593
+ Suite.prototype.serialize = function serialize() {
594
+ return {
595
+ _bail: this._bail,
596
+ $$fullTitle: this.fullTitle(),
597
+ $$isPending: Boolean(this.isPending()),
598
+ root: this.root,
599
+ title: this.title,
600
+ [MOCHA_ID_PROP_NAME]: this.id,
601
+ parent: this.parent ? {[MOCHA_ID_PROP_NAME]: this.parent.id} : null
602
+ };
603
+ };
604
+
605
+ var constants = defineConstants(
606
+ /**
607
+ * {@link Suite}-related constants.
608
+ * @public
609
+ * @memberof Suite
610
+ * @alias constants
611
+ * @readonly
612
+ * @static
613
+ * @enum {string}
614
+ */
615
+ {
616
+ /**
617
+ * Event emitted after a test file has been loaded Not emitted in browser.
618
+ */
619
+ EVENT_FILE_POST_REQUIRE: 'post-require',
620
+ /**
621
+ * Event emitted before a test file has been loaded. In browser, this is emitted once an interface has been selected.
622
+ */
623
+ EVENT_FILE_PRE_REQUIRE: 'pre-require',
624
+ /**
625
+ * Event emitted immediately after a test file has been loaded. Not emitted in browser.
626
+ */
627
+ EVENT_FILE_REQUIRE: 'require',
628
+ /**
629
+ * Event emitted when `global.run()` is called (use with `delay` option)
630
+ */
631
+ EVENT_ROOT_SUITE_RUN: 'run',
632
+
633
+ /**
634
+ * Namespace for collection of a `Suite`'s "after all" hooks
635
+ */
636
+ HOOK_TYPE_AFTER_ALL: 'afterAll',
637
+ /**
638
+ * Namespace for collection of a `Suite`'s "after each" hooks
639
+ */
640
+ HOOK_TYPE_AFTER_EACH: 'afterEach',
641
+ /**
642
+ * Namespace for collection of a `Suite`'s "before all" hooks
643
+ */
644
+ HOOK_TYPE_BEFORE_ALL: 'beforeAll',
645
+ /**
646
+ * Namespace for collection of a `Suite`'s "before all" hooks
647
+ */
648
+ HOOK_TYPE_BEFORE_EACH: 'beforeEach',
649
+
650
+ // the following events are all deprecated
651
+
652
+ /**
653
+ * Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
654
+ */
655
+ EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
656
+ /**
657
+ * Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
658
+ */
659
+ EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
660
+ /**
661
+ * Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
662
+ */
663
+ EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
664
+ /**
665
+ * Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
666
+ */
667
+ EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
668
+ /**
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
674
+ */
675
+ EVENT_SUITE_ADD_TEST: 'test'
676
+ }
677
+ );
678
+
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
+ Suite.constants = constants;