mocha 9.1.3 → 9.1.4
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/LICENSE +1 -1
- package/README.md +1 -1
- package/browser-entry.js +15 -15
- package/lib/browser/growl.js +5 -5
- package/lib/browser/parse-query.js +1 -1
- package/lib/browser/progress.js +6 -6
- package/lib/cli/run.js +1 -1
- package/lib/cli/watch-run.js +1 -4
- package/lib/context.js +5 -5
- package/lib/errors.js +1 -1
- package/lib/hook.js +2 -2
- package/lib/interfaces/bdd.js +23 -20
- package/lib/interfaces/common.js +7 -7
- package/lib/interfaces/exports.js +1 -1
- package/lib/interfaces/qunit.js +7 -7
- package/lib/interfaces/tdd.js +9 -9
- package/lib/mocha.js +56 -58
- package/lib/nodejs/esm-utils.js +18 -3
- package/lib/reporters/base.js +18 -21
- package/lib/reporters/doc.js +4 -4
- package/lib/reporters/dot.js +5 -5
- package/lib/reporters/html.js +12 -12
- package/lib/reporters/json-stream.js +4 -4
- package/lib/reporters/json.js +7 -7
- package/lib/reporters/landing.js +5 -5
- package/lib/reporters/list.js +5 -5
- package/lib/reporters/markdown.js +5 -5
- package/lib/reporters/min.js +1 -1
- package/lib/reporters/nyan.js +16 -16
- package/lib/reporters/progress.js +3 -3
- package/lib/reporters/spec.js +6 -6
- package/lib/reporters/tap.js +17 -17
- package/lib/reporters/xunit.js +9 -9
- package/lib/runnable.js +21 -21
- package/lib/runner.js +44 -47
- package/lib/stats-collector.js +7 -7
- package/lib/suite.js +29 -29
- package/lib/test.js +4 -4
- package/lib/utils.js +18 -19
- package/mocha-es2018.js +380 -386
- package/mocha.js +752 -551
- package/mocha.js.map +1 -1
- package/package.json +16 -15
- package/CHANGELOG.md +0 -1025
package/lib/suite.js
CHANGED
|
@@ -35,7 +35,7 @@ exports = module.exports = Suite;
|
|
|
35
35
|
* @param {string} title - Title
|
|
36
36
|
* @return {Suite}
|
|
37
37
|
*/
|
|
38
|
-
Suite.create = function(parent, title) {
|
|
38
|
+
Suite.create = function (parent, title) {
|
|
39
39
|
var suite = new Suite(title, parent.ctx);
|
|
40
40
|
suite.parent = parent;
|
|
41
41
|
title = suite.fullTitle();
|
|
@@ -101,7 +101,7 @@ inherits(Suite, EventEmitter);
|
|
|
101
101
|
/**
|
|
102
102
|
* Resets the state initially or for a next run.
|
|
103
103
|
*/
|
|
104
|
-
Suite.prototype.reset = function() {
|
|
104
|
+
Suite.prototype.reset = function () {
|
|
105
105
|
this.delayed = false;
|
|
106
106
|
function doReset(thingToReset) {
|
|
107
107
|
thingToReset.reset();
|
|
@@ -120,7 +120,7 @@ Suite.prototype.reset = function() {
|
|
|
120
120
|
* @private
|
|
121
121
|
* @return {Suite}
|
|
122
122
|
*/
|
|
123
|
-
Suite.prototype.clone = function() {
|
|
123
|
+
Suite.prototype.clone = function () {
|
|
124
124
|
var suite = new Suite(this.title);
|
|
125
125
|
debug('clone');
|
|
126
126
|
suite.ctx = this.ctx;
|
|
@@ -140,7 +140,7 @@ Suite.prototype.clone = function() {
|
|
|
140
140
|
* @param {number|string} ms
|
|
141
141
|
* @return {Suite|number} for chaining
|
|
142
142
|
*/
|
|
143
|
-
Suite.prototype.timeout = function(ms) {
|
|
143
|
+
Suite.prototype.timeout = function (ms) {
|
|
144
144
|
if (!arguments.length) {
|
|
145
145
|
return this._timeout;
|
|
146
146
|
}
|
|
@@ -165,7 +165,7 @@ Suite.prototype.timeout = function(ms) {
|
|
|
165
165
|
* @param {number|string} n
|
|
166
166
|
* @return {Suite|number} for chaining
|
|
167
167
|
*/
|
|
168
|
-
Suite.prototype.retries = function(n) {
|
|
168
|
+
Suite.prototype.retries = function (n) {
|
|
169
169
|
if (!arguments.length) {
|
|
170
170
|
return this._retries;
|
|
171
171
|
}
|
|
@@ -181,7 +181,7 @@ Suite.prototype.retries = function(n) {
|
|
|
181
181
|
* @param {number|string} ms
|
|
182
182
|
* @return {Suite|number} for chaining
|
|
183
183
|
*/
|
|
184
|
-
Suite.prototype.slow = function(ms) {
|
|
184
|
+
Suite.prototype.slow = function (ms) {
|
|
185
185
|
if (!arguments.length) {
|
|
186
186
|
return this._slow;
|
|
187
187
|
}
|
|
@@ -200,7 +200,7 @@ Suite.prototype.slow = function(ms) {
|
|
|
200
200
|
* @param {boolean} bail
|
|
201
201
|
* @return {Suite|number} for chaining
|
|
202
202
|
*/
|
|
203
|
-
Suite.prototype.bail = function(bail) {
|
|
203
|
+
Suite.prototype.bail = function (bail) {
|
|
204
204
|
if (!arguments.length) {
|
|
205
205
|
return this._bail;
|
|
206
206
|
}
|
|
@@ -214,7 +214,7 @@ Suite.prototype.bail = function(bail) {
|
|
|
214
214
|
*
|
|
215
215
|
* @private
|
|
216
216
|
*/
|
|
217
|
-
Suite.prototype.isPending = function() {
|
|
217
|
+
Suite.prototype.isPending = function () {
|
|
218
218
|
return this.pending || (this.parent && this.parent.isPending());
|
|
219
219
|
};
|
|
220
220
|
|
|
@@ -225,7 +225,7 @@ Suite.prototype.isPending = function() {
|
|
|
225
225
|
* @param {Function} fn - Hook callback
|
|
226
226
|
* @returns {Hook} A new hook
|
|
227
227
|
*/
|
|
228
|
-
Suite.prototype._createHook = function(title, fn) {
|
|
228
|
+
Suite.prototype._createHook = function (title, fn) {
|
|
229
229
|
var hook = new Hook(title, fn);
|
|
230
230
|
hook.parent = this;
|
|
231
231
|
hook.timeout(this.timeout());
|
|
@@ -244,7 +244,7 @@ Suite.prototype._createHook = function(title, fn) {
|
|
|
244
244
|
* @param {Function} fn
|
|
245
245
|
* @return {Suite} for chaining
|
|
246
246
|
*/
|
|
247
|
-
Suite.prototype.beforeAll = function(title, fn) {
|
|
247
|
+
Suite.prototype.beforeAll = function (title, fn) {
|
|
248
248
|
if (this.isPending()) {
|
|
249
249
|
return this;
|
|
250
250
|
}
|
|
@@ -268,7 +268,7 @@ Suite.prototype.beforeAll = function(title, fn) {
|
|
|
268
268
|
* @param {Function} fn
|
|
269
269
|
* @return {Suite} for chaining
|
|
270
270
|
*/
|
|
271
|
-
Suite.prototype.afterAll = function(title, fn) {
|
|
271
|
+
Suite.prototype.afterAll = function (title, fn) {
|
|
272
272
|
if (this.isPending()) {
|
|
273
273
|
return this;
|
|
274
274
|
}
|
|
@@ -292,7 +292,7 @@ Suite.prototype.afterAll = function(title, fn) {
|
|
|
292
292
|
* @param {Function} fn
|
|
293
293
|
* @return {Suite} for chaining
|
|
294
294
|
*/
|
|
295
|
-
Suite.prototype.beforeEach = function(title, fn) {
|
|
295
|
+
Suite.prototype.beforeEach = function (title, fn) {
|
|
296
296
|
if (this.isPending()) {
|
|
297
297
|
return this;
|
|
298
298
|
}
|
|
@@ -316,7 +316,7 @@ Suite.prototype.beforeEach = function(title, fn) {
|
|
|
316
316
|
* @param {Function} fn
|
|
317
317
|
* @return {Suite} for chaining
|
|
318
318
|
*/
|
|
319
|
-
Suite.prototype.afterEach = function(title, fn) {
|
|
319
|
+
Suite.prototype.afterEach = function (title, fn) {
|
|
320
320
|
if (this.isPending()) {
|
|
321
321
|
return this;
|
|
322
322
|
}
|
|
@@ -339,7 +339,7 @@ Suite.prototype.afterEach = function(title, fn) {
|
|
|
339
339
|
* @param {Suite} suite
|
|
340
340
|
* @return {Suite} for chaining
|
|
341
341
|
*/
|
|
342
|
-
Suite.prototype.addSuite = function(suite) {
|
|
342
|
+
Suite.prototype.addSuite = function (suite) {
|
|
343
343
|
suite.parent = this;
|
|
344
344
|
suite.root = false;
|
|
345
345
|
suite.timeout(this.timeout());
|
|
@@ -358,7 +358,7 @@ Suite.prototype.addSuite = function(suite) {
|
|
|
358
358
|
* @param {Test} test
|
|
359
359
|
* @return {Suite} for chaining
|
|
360
360
|
*/
|
|
361
|
-
Suite.prototype.addTest = function(test) {
|
|
361
|
+
Suite.prototype.addTest = function (test) {
|
|
362
362
|
test.parent = this;
|
|
363
363
|
test.timeout(this.timeout());
|
|
364
364
|
test.retries(this.retries());
|
|
@@ -377,7 +377,7 @@ Suite.prototype.addTest = function(test) {
|
|
|
377
377
|
* @public
|
|
378
378
|
* @return {string}
|
|
379
379
|
*/
|
|
380
|
-
Suite.prototype.fullTitle = function() {
|
|
380
|
+
Suite.prototype.fullTitle = function () {
|
|
381
381
|
return this.titlePath().join(' ');
|
|
382
382
|
};
|
|
383
383
|
|
|
@@ -389,7 +389,7 @@ Suite.prototype.fullTitle = function() {
|
|
|
389
389
|
* @public
|
|
390
390
|
* @return {string}
|
|
391
391
|
*/
|
|
392
|
-
Suite.prototype.titlePath = function() {
|
|
392
|
+
Suite.prototype.titlePath = function () {
|
|
393
393
|
var result = [];
|
|
394
394
|
if (this.parent) {
|
|
395
395
|
result = result.concat(this.parent.titlePath());
|
|
@@ -407,9 +407,9 @@ Suite.prototype.titlePath = function() {
|
|
|
407
407
|
* @public
|
|
408
408
|
* @return {number}
|
|
409
409
|
*/
|
|
410
|
-
Suite.prototype.total = function() {
|
|
410
|
+
Suite.prototype.total = function () {
|
|
411
411
|
return (
|
|
412
|
-
this.suites.reduce(function(sum, suite) {
|
|
412
|
+
this.suites.reduce(function (sum, suite) {
|
|
413
413
|
return sum + suite.total();
|
|
414
414
|
}, 0) + this.tests.length
|
|
415
415
|
);
|
|
@@ -423,9 +423,9 @@ Suite.prototype.total = function() {
|
|
|
423
423
|
* @param {Function} fn
|
|
424
424
|
* @return {Suite}
|
|
425
425
|
*/
|
|
426
|
-
Suite.prototype.eachTest = function(fn) {
|
|
426
|
+
Suite.prototype.eachTest = function (fn) {
|
|
427
427
|
this.tests.forEach(fn);
|
|
428
|
-
this.suites.forEach(function(suite) {
|
|
428
|
+
this.suites.forEach(function (suite) {
|
|
429
429
|
suite.eachTest(fn);
|
|
430
430
|
});
|
|
431
431
|
return this;
|
|
@@ -451,7 +451,7 @@ Suite.prototype.hasOnly = function hasOnly() {
|
|
|
451
451
|
return (
|
|
452
452
|
this._onlyTests.length > 0 ||
|
|
453
453
|
this._onlySuites.length > 0 ||
|
|
454
|
-
this.suites.some(function(suite) {
|
|
454
|
+
this.suites.some(function (suite) {
|
|
455
455
|
return suite.hasOnly();
|
|
456
456
|
})
|
|
457
457
|
);
|
|
@@ -471,7 +471,7 @@ Suite.prototype.filterOnly = function filterOnly() {
|
|
|
471
471
|
} else {
|
|
472
472
|
// Otherwise, do not run any of the tests in this suite.
|
|
473
473
|
this.tests = [];
|
|
474
|
-
this._onlySuites.forEach(function(onlySuite) {
|
|
474
|
+
this._onlySuites.forEach(function (onlySuite) {
|
|
475
475
|
// If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
|
|
476
476
|
// Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
|
|
477
477
|
if (onlySuite.hasOnly()) {
|
|
@@ -480,7 +480,7 @@ Suite.prototype.filterOnly = function filterOnly() {
|
|
|
480
480
|
});
|
|
481
481
|
// Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
|
|
482
482
|
var onlySuites = this._onlySuites;
|
|
483
|
-
this.suites = this.suites.filter(function(childSuite) {
|
|
483
|
+
this.suites = this.suites.filter(function (childSuite) {
|
|
484
484
|
return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
|
|
485
485
|
});
|
|
486
486
|
}
|
|
@@ -494,7 +494,7 @@ Suite.prototype.filterOnly = function filterOnly() {
|
|
|
494
494
|
* @private
|
|
495
495
|
* @param {Suite} suite
|
|
496
496
|
*/
|
|
497
|
-
Suite.prototype.appendOnlySuite = function(suite) {
|
|
497
|
+
Suite.prototype.appendOnlySuite = function (suite) {
|
|
498
498
|
this._onlySuites.push(suite);
|
|
499
499
|
};
|
|
500
500
|
|
|
@@ -503,7 +503,7 @@ Suite.prototype.appendOnlySuite = function(suite) {
|
|
|
503
503
|
*
|
|
504
504
|
* @private
|
|
505
505
|
*/
|
|
506
|
-
Suite.prototype.markOnly = function() {
|
|
506
|
+
Suite.prototype.markOnly = function () {
|
|
507
507
|
this.parent && this.parent.appendOnlySuite(this);
|
|
508
508
|
};
|
|
509
509
|
|
|
@@ -513,7 +513,7 @@ Suite.prototype.markOnly = function() {
|
|
|
513
513
|
* @private
|
|
514
514
|
* @param {Test} test
|
|
515
515
|
*/
|
|
516
|
-
Suite.prototype.appendOnlyTest = function(test) {
|
|
516
|
+
Suite.prototype.appendOnlyTest = function (test) {
|
|
517
517
|
this._onlyTests.push(test);
|
|
518
518
|
};
|
|
519
519
|
|
|
@@ -528,8 +528,8 @@ Suite.prototype.getHooks = function getHooks(name) {
|
|
|
528
528
|
/**
|
|
529
529
|
* cleans all references from this suite and all child suites.
|
|
530
530
|
*/
|
|
531
|
-
Suite.prototype.dispose = function() {
|
|
532
|
-
this.suites.forEach(function(suite) {
|
|
531
|
+
Suite.prototype.dispose = function () {
|
|
532
|
+
this.suites.forEach(function (suite) {
|
|
533
533
|
suite.dispose();
|
|
534
534
|
});
|
|
535
535
|
this.cleanReferences();
|
package/lib/test.js
CHANGED
|
@@ -41,7 +41,7 @@ utils.inherits(Test, Runnable);
|
|
|
41
41
|
/**
|
|
42
42
|
* Resets the state initially or for a next run.
|
|
43
43
|
*/
|
|
44
|
-
Test.prototype.reset = function() {
|
|
44
|
+
Test.prototype.reset = function () {
|
|
45
45
|
Runnable.prototype.reset.call(this);
|
|
46
46
|
this.pending = !this.fn;
|
|
47
47
|
delete this.state;
|
|
@@ -52,7 +52,7 @@ Test.prototype.reset = function() {
|
|
|
52
52
|
*
|
|
53
53
|
* @private
|
|
54
54
|
*/
|
|
55
|
-
Test.prototype.retriedTest = function(n) {
|
|
55
|
+
Test.prototype.retriedTest = function (n) {
|
|
56
56
|
if (!arguments.length) {
|
|
57
57
|
return this._retriedTest;
|
|
58
58
|
}
|
|
@@ -64,11 +64,11 @@ Test.prototype.retriedTest = function(n) {
|
|
|
64
64
|
*
|
|
65
65
|
* @private
|
|
66
66
|
*/
|
|
67
|
-
Test.prototype.markOnly = function() {
|
|
67
|
+
Test.prototype.markOnly = function () {
|
|
68
68
|
this.parent.appendOnlyTest(this);
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
Test.prototype.clone = function() {
|
|
71
|
+
Test.prototype.clone = function () {
|
|
72
72
|
var test = new Test(this.title, this.fn);
|
|
73
73
|
test.timeout(this.timeout());
|
|
74
74
|
test.slow(this.slow());
|
package/lib/utils.js
CHANGED
|
@@ -34,7 +34,7 @@ exports.inherits = util.inherits;
|
|
|
34
34
|
* @param {string} html
|
|
35
35
|
* @return {string}
|
|
36
36
|
*/
|
|
37
|
-
exports.escape = function(html) {
|
|
37
|
+
exports.escape = function (html) {
|
|
38
38
|
return he.encode(String(html), {useNamedReferences: false});
|
|
39
39
|
};
|
|
40
40
|
|
|
@@ -45,7 +45,7 @@ exports.escape = function(html) {
|
|
|
45
45
|
* @param {Object} obj
|
|
46
46
|
* @return {boolean}
|
|
47
47
|
*/
|
|
48
|
-
exports.isString = function(obj) {
|
|
48
|
+
exports.isString = function (obj) {
|
|
49
49
|
return typeof obj === 'string';
|
|
50
50
|
};
|
|
51
51
|
|
|
@@ -56,7 +56,7 @@ exports.isString = function(obj) {
|
|
|
56
56
|
* @param {string} str
|
|
57
57
|
* @return {string}
|
|
58
58
|
*/
|
|
59
|
-
exports.slug = function(str) {
|
|
59
|
+
exports.slug = function (str) {
|
|
60
60
|
return str
|
|
61
61
|
.toLowerCase()
|
|
62
62
|
.replace(/\s+/g, '-')
|
|
@@ -70,7 +70,7 @@ exports.slug = function(str) {
|
|
|
70
70
|
* @param {string} str
|
|
71
71
|
* @return {string}
|
|
72
72
|
*/
|
|
73
|
-
exports.clean = function(str) {
|
|
73
|
+
exports.clean = function (str) {
|
|
74
74
|
str = str
|
|
75
75
|
.replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
|
|
76
76
|
.replace(/^\uFEFF/, '')
|
|
@@ -212,7 +212,7 @@ exports.type = function type(value) {
|
|
|
212
212
|
* @param {*} value
|
|
213
213
|
* @return {string}
|
|
214
214
|
*/
|
|
215
|
-
exports.stringify = function(value) {
|
|
215
|
+
exports.stringify = function (value) {
|
|
216
216
|
var typeHint = canonicalType(value);
|
|
217
217
|
|
|
218
218
|
if (!~['object', 'array', 'function'].indexOf(typeHint)) {
|
|
@@ -228,7 +228,7 @@ exports.stringify = function(value) {
|
|
|
228
228
|
// IE7/IE8 has a bizarre String constructor; needs to be coerced
|
|
229
229
|
// into an array and back to obj.
|
|
230
230
|
if (typeHint === 'string' && typeof value === 'object') {
|
|
231
|
-
value = value.split('').reduce(function(acc, char, idx) {
|
|
231
|
+
value = value.split('').reduce(function (acc, char, idx) {
|
|
232
232
|
acc[idx] = char;
|
|
233
233
|
return acc;
|
|
234
234
|
}, {});
|
|
@@ -383,8 +383,8 @@ exports.canonicalize = function canonicalize(value, stack, typeHint) {
|
|
|
383
383
|
canonicalizedObj = value;
|
|
384
384
|
break;
|
|
385
385
|
case 'array':
|
|
386
|
-
withStack(value, function() {
|
|
387
|
-
canonicalizedObj = value.map(function(item) {
|
|
386
|
+
withStack(value, function () {
|
|
387
|
+
canonicalizedObj = value.map(function (item) {
|
|
388
388
|
return exports.canonicalize(item, stack);
|
|
389
389
|
});
|
|
390
390
|
});
|
|
@@ -403,10 +403,10 @@ exports.canonicalize = function canonicalize(value, stack, typeHint) {
|
|
|
403
403
|
/* falls through */
|
|
404
404
|
case 'object':
|
|
405
405
|
canonicalizedObj = canonicalizedObj || {};
|
|
406
|
-
withStack(value, function() {
|
|
406
|
+
withStack(value, function () {
|
|
407
407
|
Object.keys(value)
|
|
408
408
|
.sort()
|
|
409
|
-
.forEach(function(key) {
|
|
409
|
+
.forEach(function (key) {
|
|
410
410
|
canonicalizedObj[key] = exports.canonicalize(value[key], stack);
|
|
411
411
|
});
|
|
412
412
|
});
|
|
@@ -434,7 +434,7 @@ exports.canonicalize = function canonicalize(value, stack, typeHint) {
|
|
|
434
434
|
* (i.e: strip Mocha and internal node functions from stack trace).
|
|
435
435
|
* @returns {Function}
|
|
436
436
|
*/
|
|
437
|
-
exports.stackTraceFilter = function() {
|
|
437
|
+
exports.stackTraceFilter = function () {
|
|
438
438
|
// TODO: Replace with `process.browser`
|
|
439
439
|
var is = typeof document === 'undefined' ? {node: true} : {browser: true};
|
|
440
440
|
var slash = path.sep;
|
|
@@ -442,9 +442,8 @@ exports.stackTraceFilter = function() {
|
|
|
442
442
|
if (is.node) {
|
|
443
443
|
cwd = exports.cwd() + slash;
|
|
444
444
|
} else {
|
|
445
|
-
cwd = (
|
|
446
|
-
? window.location
|
|
447
|
-
: location
|
|
445
|
+
cwd = (
|
|
446
|
+
typeof location === 'undefined' ? window.location : location
|
|
448
447
|
).href.replace(/\/[^/]*$/, '/');
|
|
449
448
|
slash = '/';
|
|
450
449
|
}
|
|
@@ -468,10 +467,10 @@ exports.stackTraceFilter = function() {
|
|
|
468
467
|
);
|
|
469
468
|
}
|
|
470
469
|
|
|
471
|
-
return function(stack) {
|
|
470
|
+
return function (stack) {
|
|
472
471
|
stack = stack.split('\n');
|
|
473
472
|
|
|
474
|
-
stack = stack.reduce(function(list, line) {
|
|
473
|
+
stack = stack.reduce(function (list, line) {
|
|
475
474
|
if (isMochaInternal(line)) {
|
|
476
475
|
return list;
|
|
477
476
|
}
|
|
@@ -522,7 +521,7 @@ exports.clamp = function clamp(value, range) {
|
|
|
522
521
|
* It's a noop.
|
|
523
522
|
* @public
|
|
524
523
|
*/
|
|
525
|
-
exports.noop = function() {};
|
|
524
|
+
exports.noop = function () {};
|
|
526
525
|
|
|
527
526
|
/**
|
|
528
527
|
* Creates a map-like object.
|
|
@@ -539,7 +538,7 @@ exports.noop = function() {};
|
|
|
539
538
|
* @param {...*} [obj] - Arguments to `Object.assign()`.
|
|
540
539
|
* @returns {Object} An object with no prototype, having `...obj` properties
|
|
541
540
|
*/
|
|
542
|
-
exports.createMap = function(obj) {
|
|
541
|
+
exports.createMap = function (obj) {
|
|
543
542
|
return Object.assign.apply(
|
|
544
543
|
null,
|
|
545
544
|
[Object.create(null)].concat(Array.prototype.slice.call(arguments))
|
|
@@ -558,7 +557,7 @@ exports.createMap = function(obj) {
|
|
|
558
557
|
* @returns {Object} A frozen object with no prototype, having `...obj` properties
|
|
559
558
|
* @throws {TypeError} if argument is not a non-empty object.
|
|
560
559
|
*/
|
|
561
|
-
exports.defineConstants = function(obj) {
|
|
560
|
+
exports.defineConstants = function (obj) {
|
|
562
561
|
if (canonicalType(obj) !== 'object' || !Object.keys(obj).length) {
|
|
563
562
|
throw new TypeError('Invalid argument; expected a non-empty object');
|
|
564
563
|
}
|