@gjsify/assert 0.3.13 → 0.3.15

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/lib/esm/index.js CHANGED
@@ -1,464 +1,431 @@
1
1
  import { AssertionError } from "./assertion-error.js";
2
2
  import { isDeepEqual, isDeepStrictEqual } from "./deep-equal.js";
3
+
4
+ //#region src/index.ts
3
5
  function innerFail(obj) {
4
- if (obj.message instanceof Error) throw obj.message;
5
- throw new AssertionError({
6
- actual: obj.actual,
7
- expected: obj.expected,
8
- message: obj.message,
9
- operator: obj.operator,
10
- stackStartFn: obj.stackStartFn
11
- });
6
+ if (obj.message instanceof Error) throw obj.message;
7
+ throw new AssertionError({
8
+ actual: obj.actual,
9
+ expected: obj.expected,
10
+ message: obj.message,
11
+ operator: obj.operator,
12
+ stackStartFn: obj.stackStartFn
13
+ });
12
14
  }
13
15
  function isPromiseLike(val) {
14
- return val !== null && typeof val === "object" && typeof val.then === "function";
16
+ return val !== null && typeof val === "object" && typeof val.then === "function";
15
17
  }
16
18
  function ok(value, message) {
17
- if (!value) {
18
- innerFail({
19
- actual: value,
20
- expected: true,
21
- message,
22
- operator: "==",
23
- stackStartFn: ok
24
- });
25
- }
19
+ if (!value) {
20
+ innerFail({
21
+ actual: value,
22
+ expected: true,
23
+ message,
24
+ operator: "==",
25
+ stackStartFn: ok
26
+ });
27
+ }
26
28
  }
27
29
  function equal(actual, expected, message) {
28
- if (actual != expected) {
29
- innerFail({
30
- actual,
31
- expected,
32
- message,
33
- operator: "==",
34
- stackStartFn: equal
35
- });
36
- }
30
+ if (actual != expected) {
31
+ innerFail({
32
+ actual,
33
+ expected,
34
+ message,
35
+ operator: "==",
36
+ stackStartFn: equal
37
+ });
38
+ }
37
39
  }
38
40
  function notEqual(actual, expected, message) {
39
- if (actual == expected) {
40
- innerFail({
41
- actual,
42
- expected,
43
- message,
44
- operator: "!=",
45
- stackStartFn: notEqual
46
- });
47
- }
41
+ if (actual == expected) {
42
+ innerFail({
43
+ actual,
44
+ expected,
45
+ message,
46
+ operator: "!=",
47
+ stackStartFn: notEqual
48
+ });
49
+ }
48
50
  }
49
51
  function strictEqual(actual, expected, message) {
50
- if (!Object.is(actual, expected)) {
51
- innerFail({
52
- actual,
53
- expected,
54
- message,
55
- operator: "strictEqual",
56
- stackStartFn: strictEqual
57
- });
58
- }
52
+ if (!Object.is(actual, expected)) {
53
+ innerFail({
54
+ actual,
55
+ expected,
56
+ message,
57
+ operator: "strictEqual",
58
+ stackStartFn: strictEqual
59
+ });
60
+ }
59
61
  }
60
62
  function notStrictEqual(actual, expected, message) {
61
- if (Object.is(actual, expected)) {
62
- innerFail({
63
- actual,
64
- expected,
65
- message,
66
- operator: "notStrictEqual",
67
- stackStartFn: notStrictEqual
68
- });
69
- }
63
+ if (Object.is(actual, expected)) {
64
+ innerFail({
65
+ actual,
66
+ expected,
67
+ message,
68
+ operator: "notStrictEqual",
69
+ stackStartFn: notStrictEqual
70
+ });
71
+ }
70
72
  }
71
73
  function deepEqual(actual, expected, message) {
72
- if (!isDeepEqual(actual, expected)) {
73
- innerFail({
74
- actual,
75
- expected,
76
- message,
77
- operator: "deepEqual",
78
- stackStartFn: deepEqual
79
- });
80
- }
74
+ if (!isDeepEqual(actual, expected)) {
75
+ innerFail({
76
+ actual,
77
+ expected,
78
+ message,
79
+ operator: "deepEqual",
80
+ stackStartFn: deepEqual
81
+ });
82
+ }
81
83
  }
82
84
  function notDeepEqual(actual, expected, message) {
83
- if (isDeepEqual(actual, expected)) {
84
- innerFail({
85
- actual,
86
- expected,
87
- message,
88
- operator: "notDeepEqual",
89
- stackStartFn: notDeepEqual
90
- });
91
- }
85
+ if (isDeepEqual(actual, expected)) {
86
+ innerFail({
87
+ actual,
88
+ expected,
89
+ message,
90
+ operator: "notDeepEqual",
91
+ stackStartFn: notDeepEqual
92
+ });
93
+ }
92
94
  }
93
95
  function deepStrictEqual(actual, expected, message) {
94
- if (!isDeepStrictEqual(actual, expected)) {
95
- innerFail({
96
- actual,
97
- expected,
98
- message,
99
- operator: "deepStrictEqual",
100
- stackStartFn: deepStrictEqual
101
- });
102
- }
96
+ if (!isDeepStrictEqual(actual, expected)) {
97
+ innerFail({
98
+ actual,
99
+ expected,
100
+ message,
101
+ operator: "deepStrictEqual",
102
+ stackStartFn: deepStrictEqual
103
+ });
104
+ }
103
105
  }
104
106
  function notDeepStrictEqual(actual, expected, message) {
105
- if (isDeepStrictEqual(actual, expected)) {
106
- innerFail({
107
- actual,
108
- expected,
109
- message,
110
- operator: "notDeepStrictEqual",
111
- stackStartFn: notDeepStrictEqual
112
- });
113
- }
107
+ if (isDeepStrictEqual(actual, expected)) {
108
+ innerFail({
109
+ actual,
110
+ expected,
111
+ message,
112
+ operator: "notDeepStrictEqual",
113
+ stackStartFn: notDeepStrictEqual
114
+ });
115
+ }
114
116
  }
115
117
  function getActual(fn) {
116
- const NO_EXCEPTION = /* @__PURE__ */ Symbol("NO_EXCEPTION");
117
- try {
118
- fn();
119
- } catch (e) {
120
- return e;
121
- }
122
- return NO_EXCEPTION;
118
+ const NO_EXCEPTION = Symbol("NO_EXCEPTION");
119
+ try {
120
+ fn();
121
+ } catch (e) {
122
+ return e;
123
+ }
124
+ return NO_EXCEPTION;
123
125
  }
124
126
  async function getActualAsync(fn) {
125
- const NO_EXCEPTION = /* @__PURE__ */ Symbol("NO_EXCEPTION");
126
- try {
127
- if (typeof fn === "function") {
128
- const result = fn();
129
- if (isPromiseLike(result)) {
130
- await result;
131
- }
132
- } else {
133
- await fn;
134
- }
135
- } catch (e) {
136
- return e;
137
- }
138
- return NO_EXCEPTION;
127
+ const NO_EXCEPTION = Symbol("NO_EXCEPTION");
128
+ try {
129
+ if (typeof fn === "function") {
130
+ const result = fn();
131
+ if (isPromiseLike(result)) {
132
+ await result;
133
+ }
134
+ } else {
135
+ await fn;
136
+ }
137
+ } catch (e) {
138
+ return e;
139
+ }
140
+ return NO_EXCEPTION;
139
141
  }
140
142
  function expectedException(actual, expected, message, fn) {
141
- if (expected === void 0) return true;
142
- if (expected instanceof RegExp) {
143
- const str = String(actual);
144
- if (expected.test(str)) return true;
145
- throw new AssertionError({
146
- actual,
147
- expected,
148
- message,
149
- operator: fn.name,
150
- stackStartFn: fn
151
- });
152
- }
153
- if (typeof expected === "function") {
154
- if (expected.prototype !== void 0 && actual instanceof expected) {
155
- return true;
156
- }
157
- if (Error.isPrototypeOf(expected)) {
158
- return false;
159
- }
160
- const result = expected.call({}, actual);
161
- if (result !== true) {
162
- throw new AssertionError({
163
- actual,
164
- expected,
165
- message,
166
- operator: fn.name,
167
- stackStartFn: fn
168
- });
169
- }
170
- return true;
171
- }
172
- if (typeof expected === "object" && expected !== null) {
173
- const keys = Object.keys(expected);
174
- for (const key of keys) {
175
- const expectedObj = expected;
176
- const actualObj = actual;
177
- if (typeof actualObj[key] === "string" && expectedObj[key] instanceof RegExp) {
178
- if (!expectedObj[key].test(actualObj[key])) {
179
- throw new AssertionError({
180
- actual,
181
- expected,
182
- message,
183
- operator: fn.name,
184
- stackStartFn: fn
185
- });
186
- }
187
- } else if (!isDeepStrictEqual(actualObj[key], expectedObj[key])) {
188
- throw new AssertionError({
189
- actual,
190
- expected,
191
- message,
192
- operator: fn.name,
193
- stackStartFn: fn
194
- });
195
- }
196
- }
197
- return true;
198
- }
199
- return true;
143
+ if (expected === undefined) return true;
144
+ if (expected instanceof RegExp) {
145
+ const str = String(actual);
146
+ if (expected.test(str)) return true;
147
+ throw new AssertionError({
148
+ actual,
149
+ expected,
150
+ message,
151
+ operator: fn.name,
152
+ stackStartFn: fn
153
+ });
154
+ }
155
+ if (typeof expected === "function") {
156
+ if (expected.prototype !== undefined && actual instanceof expected) {
157
+ return true;
158
+ }
159
+ if (Error.isPrototypeOf(expected)) {
160
+ return false;
161
+ }
162
+ const result = expected.call({}, actual);
163
+ if (result !== true) {
164
+ throw new AssertionError({
165
+ actual,
166
+ expected,
167
+ message,
168
+ operator: fn.name,
169
+ stackStartFn: fn
170
+ });
171
+ }
172
+ return true;
173
+ }
174
+ if (typeof expected === "object" && expected !== null) {
175
+ const keys = Object.keys(expected);
176
+ for (const key of keys) {
177
+ const expectedObj = expected;
178
+ const actualObj = actual;
179
+ if (typeof actualObj[key] === "string" && expectedObj[key] instanceof RegExp) {
180
+ if (!expectedObj[key].test(actualObj[key])) {
181
+ throw new AssertionError({
182
+ actual,
183
+ expected,
184
+ message,
185
+ operator: fn.name,
186
+ stackStartFn: fn
187
+ });
188
+ }
189
+ } else if (!isDeepStrictEqual(actualObj[key], expectedObj[key])) {
190
+ throw new AssertionError({
191
+ actual,
192
+ expected,
193
+ message,
194
+ operator: fn.name,
195
+ stackStartFn: fn
196
+ });
197
+ }
198
+ }
199
+ return true;
200
+ }
201
+ return true;
200
202
  }
201
203
  function throws(fn, errorOrMessage, message) {
202
- if (typeof fn !== "function") {
203
- throw new TypeError('The "fn" argument must be of type function.');
204
- }
205
- let expected;
206
- if (typeof errorOrMessage === "string") {
207
- message = errorOrMessage;
208
- expected = void 0;
209
- } else {
210
- expected = errorOrMessage;
211
- }
212
- const actual = getActual(fn);
213
- if (typeof actual === "symbol") {
214
- innerFail({
215
- actual: void 0,
216
- expected,
217
- message: message || "Missing expected exception.",
218
- operator: "throws",
219
- stackStartFn: throws
220
- });
221
- }
222
- if (expected !== void 0) {
223
- expectedException(actual, expected, message, throws);
224
- }
204
+ if (typeof fn !== "function") {
205
+ throw new TypeError("The \"fn\" argument must be of type function.");
206
+ }
207
+ let expected;
208
+ if (typeof errorOrMessage === "string") {
209
+ message = errorOrMessage;
210
+ expected = undefined;
211
+ } else {
212
+ expected = errorOrMessage;
213
+ }
214
+ const actual = getActual(fn);
215
+ if (typeof actual === "symbol") {
216
+ innerFail({
217
+ actual: undefined,
218
+ expected,
219
+ message: message || "Missing expected exception.",
220
+ operator: "throws",
221
+ stackStartFn: throws
222
+ });
223
+ }
224
+ if (expected !== undefined) {
225
+ expectedException(actual, expected, message, throws);
226
+ }
225
227
  }
226
228
  function doesNotThrow(fn, errorOrMessage, message) {
227
- if (typeof fn !== "function") {
228
- throw new TypeError('The "fn" argument must be of type function.');
229
- }
230
- let expected;
231
- if (typeof errorOrMessage === "string") {
232
- message = errorOrMessage;
233
- expected = void 0;
234
- } else {
235
- expected = errorOrMessage;
236
- }
237
- const actual = getActual(fn);
238
- if (typeof actual === "symbol") {
239
- return;
240
- }
241
- if (expected !== void 0 && typeof expected === "function" && expected.prototype !== void 0 && actual instanceof expected) {
242
- innerFail({
243
- actual,
244
- expected,
245
- message: message || `Got unwanted exception.
246
- ${actual && actual.message ? actual.message : ""}`,
247
- operator: "doesNotThrow",
248
- stackStartFn: doesNotThrow
249
- });
250
- }
251
- if (expected === void 0 || typeof expected === "function" && expected.prototype !== void 0 && actual instanceof expected) {
252
- innerFail({
253
- actual,
254
- expected,
255
- message: message || `Got unwanted exception.
256
- ${actual && actual.message ? actual.message : ""}`,
257
- operator: "doesNotThrow",
258
- stackStartFn: doesNotThrow
259
- });
260
- }
261
- throw actual;
229
+ if (typeof fn !== "function") {
230
+ throw new TypeError("The \"fn\" argument must be of type function.");
231
+ }
232
+ let expected;
233
+ if (typeof errorOrMessage === "string") {
234
+ message = errorOrMessage;
235
+ expected = undefined;
236
+ } else {
237
+ expected = errorOrMessage;
238
+ }
239
+ const actual = getActual(fn);
240
+ if (typeof actual === "symbol") {
241
+ return;
242
+ }
243
+ if (expected !== undefined && typeof expected === "function" && expected.prototype !== undefined && actual instanceof expected) {
244
+ innerFail({
245
+ actual,
246
+ expected,
247
+ message: message || `Got unwanted exception.\n${actual && actual.message ? actual.message : ""}`,
248
+ operator: "doesNotThrow",
249
+ stackStartFn: doesNotThrow
250
+ });
251
+ }
252
+ if (expected === undefined || typeof expected === "function" && expected.prototype !== undefined && actual instanceof expected) {
253
+ innerFail({
254
+ actual,
255
+ expected,
256
+ message: message || `Got unwanted exception.\n${actual && actual.message ? actual.message : ""}`,
257
+ operator: "doesNotThrow",
258
+ stackStartFn: doesNotThrow
259
+ });
260
+ }
261
+ throw actual;
262
262
  }
263
263
  async function rejects(asyncFn, errorOrMessage, message) {
264
- let expected;
265
- if (typeof errorOrMessage === "string") {
266
- message = errorOrMessage;
267
- expected = void 0;
268
- } else {
269
- expected = errorOrMessage;
270
- }
271
- const actual = await getActualAsync(asyncFn);
272
- if (typeof actual === "symbol") {
273
- innerFail({
274
- actual: void 0,
275
- expected,
276
- message: message || "Missing expected rejection.",
277
- operator: "rejects",
278
- stackStartFn: rejects
279
- });
280
- }
281
- if (expected !== void 0) {
282
- expectedException(actual, expected, message, rejects);
283
- }
264
+ let expected;
265
+ if (typeof errorOrMessage === "string") {
266
+ message = errorOrMessage;
267
+ expected = undefined;
268
+ } else {
269
+ expected = errorOrMessage;
270
+ }
271
+ const actual = await getActualAsync(asyncFn);
272
+ if (typeof actual === "symbol") {
273
+ innerFail({
274
+ actual: undefined,
275
+ expected,
276
+ message: message || "Missing expected rejection.",
277
+ operator: "rejects",
278
+ stackStartFn: rejects
279
+ });
280
+ }
281
+ if (expected !== undefined) {
282
+ expectedException(actual, expected, message, rejects);
283
+ }
284
284
  }
285
285
  async function doesNotReject(asyncFn, errorOrMessage, message) {
286
- let expected;
287
- if (typeof errorOrMessage === "string") {
288
- message = errorOrMessage;
289
- expected = void 0;
290
- } else {
291
- expected = errorOrMessage;
292
- }
293
- const actual = await getActualAsync(asyncFn);
294
- if (typeof actual !== "symbol") {
295
- innerFail({
296
- actual,
297
- expected,
298
- message: message || `Got unwanted rejection.
299
- ${actual && actual.message ? actual.message : ""}`,
300
- operator: "doesNotReject",
301
- stackStartFn: doesNotReject
302
- });
303
- }
286
+ let expected;
287
+ if (typeof errorOrMessage === "string") {
288
+ message = errorOrMessage;
289
+ expected = undefined;
290
+ } else {
291
+ expected = errorOrMessage;
292
+ }
293
+ const actual = await getActualAsync(asyncFn);
294
+ if (typeof actual !== "symbol") {
295
+ innerFail({
296
+ actual,
297
+ expected,
298
+ message: message || `Got unwanted rejection.\n${actual && actual.message ? actual.message : ""}`,
299
+ operator: "doesNotReject",
300
+ stackStartFn: doesNotReject
301
+ });
302
+ }
304
303
  }
305
304
  function fail(actualOrMessage, expected, message, operator, stackStartFn) {
306
- if (arguments.length === 0 || arguments.length === 1) {
307
- const msg = arguments.length === 0 ? "Failed" : typeof actualOrMessage === "string" ? actualOrMessage : void 0;
308
- if (actualOrMessage instanceof Error) throw actualOrMessage;
309
- throw new AssertionError({
310
- message: msg || "Failed",
311
- operator: "fail",
312
- stackStartFn: fail
313
- });
314
- }
315
- throw new AssertionError({
316
- actual: actualOrMessage,
317
- expected,
318
- message,
319
- operator: operator || "fail",
320
- stackStartFn: stackStartFn || fail
321
- });
305
+ if (arguments.length === 0 || arguments.length === 1) {
306
+ const msg = arguments.length === 0 ? "Failed" : typeof actualOrMessage === "string" ? actualOrMessage : undefined;
307
+ if (actualOrMessage instanceof Error) throw actualOrMessage;
308
+ throw new AssertionError({
309
+ message: msg || "Failed",
310
+ operator: "fail",
311
+ stackStartFn: fail
312
+ });
313
+ }
314
+ throw new AssertionError({
315
+ actual: actualOrMessage,
316
+ expected,
317
+ message,
318
+ operator: operator || "fail",
319
+ stackStartFn: stackStartFn || fail
320
+ });
322
321
  }
323
322
  function ifError(value) {
324
- if (value !== null && value !== void 0) {
325
- let message = "ifError got unwanted exception: ";
326
- if (typeof value === "object" && typeof value.message === "string") {
327
- if (value.message.length === 0 && value.constructor) {
328
- message += value.constructor.name;
329
- } else {
330
- message += value.message;
331
- }
332
- } else {
333
- message += String(value);
334
- }
335
- const err = new AssertionError({
336
- actual: value,
337
- expected: null,
338
- message,
339
- operator: "ifError",
340
- stackStartFn: ifError
341
- });
342
- const origStack = value instanceof Error ? value.stack : void 0;
343
- if (origStack) {
344
- err.origStack = origStack;
345
- }
346
- throw err;
347
- }
323
+ if (value !== null && value !== undefined) {
324
+ let message = "ifError got unwanted exception: ";
325
+ if (typeof value === "object" && typeof value.message === "string") {
326
+ if (value.message.length === 0 && value.constructor) {
327
+ message += value.constructor.name;
328
+ } else {
329
+ message += value.message;
330
+ }
331
+ } else {
332
+ message += String(value);
333
+ }
334
+ const err = new AssertionError({
335
+ actual: value,
336
+ expected: null,
337
+ message,
338
+ operator: "ifError",
339
+ stackStartFn: ifError
340
+ });
341
+ const origStack = value instanceof Error ? value.stack : undefined;
342
+ if (origStack) {
343
+ err.origStack = origStack;
344
+ }
345
+ throw err;
346
+ }
348
347
  }
349
348
  function match(actual, expected, message) {
350
- if (typeof actual !== "string") {
351
- throw new TypeError('The "actual" argument must be of type string.');
352
- }
353
- if (!(expected instanceof RegExp)) {
354
- throw new TypeError('The "expected" argument must be an instance of RegExp.');
355
- }
356
- if (!expected.test(actual)) {
357
- innerFail({
358
- actual,
359
- expected,
360
- message: message || `The input did not match the regular expression ${expected}. Input:
361
-
362
- '${actual}'
363
- `,
364
- operator: "match",
365
- stackStartFn: match
366
- });
367
- }
349
+ if (typeof actual !== "string") {
350
+ throw new TypeError("The \"actual\" argument must be of type string.");
351
+ }
352
+ if (!(expected instanceof RegExp)) {
353
+ throw new TypeError("The \"expected\" argument must be an instance of RegExp.");
354
+ }
355
+ if (!expected.test(actual)) {
356
+ innerFail({
357
+ actual,
358
+ expected,
359
+ message: message || `The input did not match the regular expression ${expected}. Input:\n\n'${actual}'\n`,
360
+ operator: "match",
361
+ stackStartFn: match
362
+ });
363
+ }
368
364
  }
369
365
  function doesNotMatch(actual, expected, message) {
370
- if (typeof actual !== "string") {
371
- throw new TypeError('The "actual" argument must be of type string.');
372
- }
373
- if (!(expected instanceof RegExp)) {
374
- throw new TypeError('The "expected" argument must be an instance of RegExp.');
375
- }
376
- if (expected.test(actual)) {
377
- innerFail({
378
- actual,
379
- expected,
380
- message: message || `The input was expected to not match the regular expression ${expected}. Input:
381
-
382
- '${actual}'
383
- `,
384
- operator: "doesNotMatch",
385
- stackStartFn: doesNotMatch
386
- });
387
- }
366
+ if (typeof actual !== "string") {
367
+ throw new TypeError("The \"actual\" argument must be of type string.");
368
+ }
369
+ if (!(expected instanceof RegExp)) {
370
+ throw new TypeError("The \"expected\" argument must be an instance of RegExp.");
371
+ }
372
+ if (expected.test(actual)) {
373
+ innerFail({
374
+ actual,
375
+ expected,
376
+ message: message || `The input was expected to not match the regular expression ${expected}. Input:\n\n'${actual}'\n`,
377
+ operator: "doesNotMatch",
378
+ stackStartFn: doesNotMatch
379
+ });
380
+ }
388
381
  }
389
- const strict = Object.assign(
390
- function strict2(value, message) {
391
- ok(value, message);
392
- },
393
- {
394
- AssertionError,
395
- ok,
396
- equal: strictEqual,
397
- notEqual: notStrictEqual,
398
- deepEqual: deepStrictEqual,
399
- notDeepEqual: notDeepStrictEqual,
400
- deepStrictEqual,
401
- notDeepStrictEqual,
402
- strictEqual,
403
- notStrictEqual,
404
- throws,
405
- doesNotThrow,
406
- rejects,
407
- doesNotReject,
408
- fail,
409
- ifError,
410
- match,
411
- doesNotMatch,
412
- strict: void 0
413
- }
414
- );
382
+ const strict = Object.assign(function strict(value, message) {
383
+ ok(value, message);
384
+ }, {
385
+ AssertionError,
386
+ ok,
387
+ equal: strictEqual,
388
+ notEqual: notStrictEqual,
389
+ deepEqual: deepStrictEqual,
390
+ notDeepEqual: notDeepStrictEqual,
391
+ deepStrictEqual,
392
+ notDeepStrictEqual,
393
+ strictEqual,
394
+ notStrictEqual,
395
+ throws,
396
+ doesNotThrow,
397
+ rejects,
398
+ doesNotReject,
399
+ fail,
400
+ ifError,
401
+ match,
402
+ doesNotMatch,
403
+ strict: undefined
404
+ });
415
405
  strict.strict = strict;
416
- const assert = Object.assign(
417
- function assert2(value, message) {
418
- ok(value, message);
419
- },
420
- {
421
- AssertionError,
422
- ok,
423
- equal,
424
- notEqual,
425
- strictEqual,
426
- notStrictEqual,
427
- deepEqual,
428
- notDeepEqual,
429
- deepStrictEqual,
430
- notDeepStrictEqual,
431
- throws,
432
- doesNotThrow,
433
- rejects,
434
- doesNotReject,
435
- fail,
436
- ifError,
437
- match,
438
- doesNotMatch,
439
- strict
440
- }
441
- );
442
- var index_default = assert;
443
- export {
444
- AssertionError,
445
- deepEqual,
446
- deepStrictEqual,
447
- index_default as default,
448
- doesNotMatch,
449
- doesNotReject,
450
- doesNotThrow,
451
- equal,
452
- fail,
453
- ifError,
454
- match,
455
- notDeepEqual,
456
- notDeepStrictEqual,
457
- notEqual,
458
- notStrictEqual,
459
- ok,
460
- rejects,
461
- strict,
462
- strictEqual,
463
- throws
464
- };
406
+ const assert = Object.assign(function assert(value, message) {
407
+ ok(value, message);
408
+ }, {
409
+ AssertionError,
410
+ ok,
411
+ equal,
412
+ notEqual,
413
+ strictEqual,
414
+ notStrictEqual,
415
+ deepEqual,
416
+ notDeepEqual,
417
+ deepStrictEqual,
418
+ notDeepStrictEqual,
419
+ throws,
420
+ doesNotThrow,
421
+ rejects,
422
+ doesNotReject,
423
+ fail,
424
+ ifError,
425
+ match,
426
+ doesNotMatch,
427
+ strict
428
+ });
429
+
430
+ //#endregion
431
+ export { AssertionError, deepEqual, deepStrictEqual, assert as default, doesNotMatch, doesNotReject, doesNotThrow, equal, fail, ifError, match, notDeepEqual, notDeepStrictEqual, notEqual, notStrictEqual, ok, rejects, strict, strictEqual, throws };