-
Notifications
You must be signed in to change notification settings - Fork 30.3k
/
Copy pathindex.d.ts
2929 lines (2553 loc) · 90.4 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Mocha API
*
* @see https://mochajs.org/api/mocha
*/
declare class Mocha {
private _growl;
private _reporter;
private _ui;
constructor(options?: Mocha.MochaOptions);
suite: Mocha.Suite;
files: string[];
options: Mocha.MochaInstanceOptions;
/**
* Add test `file`.
*
* @see https://mochajs.org/api/mocha#addFile
*/
addFile(file: string): this;
/**
* Enable or disable bailing on the first failure.
*
* @see https://mochajs.org/api/mocha#bail
*/
bail(bail?: boolean): this;
/**
* Enables or disables whether or not to dispose after each test run.
* Disable this to ensure you can run the test suite multiple times.
* If disabled, be sure to dispose mocha when you're done to prevent memory leaks.
*
* @see https://mochajs.org/api/mocha#cleanReferencesAfterRun
*/
cleanReferencesAfterRun(clean?: boolean): this;
/**
* Manually dispose this mocha instance. Mark this instance as `disposed` and unable to run more tests.
* It also removes function references to tests functions and hooks, so variables trapped in closures can be cleaned by the garbage collector.
*
* @see https://mochajs.org/api/mocha#dispose
*/
dispose(): void;
/**
* Set reporter to one of the built-in reporters.
*
* @see https://mochajs.org/api/mocha#reporter
*/
reporter(reporter: Mocha.Reporter, reporterOptions?: any): this;
/**
* Set reporter to the provided constructor, one of the built-in reporters, or loads a reporter
* from a module path. Defaults to `"spec"`.
*
* @see https://mochajs.org/api/mocha#reporter
*/
reporter(reporter?: string | Mocha.ReporterConstructor, reporterOptions?: any): this;
/**
* Set test UI to one of the built-in test interfaces.
*
* @see https://mochajs.org/api/mocha#ui
*/
ui(name: Mocha.Interface): this;
/**
* Set test UI to one of the built-in test interfaces or loads a test interface from a module
* path. Defaults to `"bdd"`.
*
* @see https://mochajs.org/api/mocha#ui
*/
ui(name?: string): this;
/**
* Escape string and add it to grep as a RegExp.
*
* @see https://mochajs.org/api/mocha#fgrep
*/
fgrep(str: string): this;
/**
* Add regexp to grep, if `re` is a string it is escaped.
*
* @see https://mochajs.org/api/mocha#grep
*/
grep(re: string | RegExp): this;
/**
* Whether to activate dry-run mode.
*
* @param dryRun Whether to activate dry-run mode. Defaults to `true`.
*/
dryRun(dryRun?: boolean): this;
/**
* Invert `.grep()` matches.
*
* @see https://mochajs.org/api/mocha#invert
*/
invert(): this;
/**
* Enable global leak checking.
*
* @see https://mochajs.org/api/mocha#checkLeaks
*/
checkLeaks(): this;
/**
* Display long stack-trace on failing
*
* @see https://mochajs.org/api/mocha#fullTrace
*/
fullTrace(): this;
/**
* Enable growl support.
*
* @see https://mochajs.org/api/mocha#growl
*/
growl(): this;
/**
* Ignore `globals` array or string.
*
* @see https://mochajs.org/api/mocha#globals
*/
globals(globals: string | readonly string[]): this;
/**
* Set the timeout in milliseconds.
*
* @see https://mochajs.org/api/mocha#timeout
*/
timeout(timeout: string | number): this;
/**
* Set the number of times to retry failed tests.
*
* @see https://mochajs.org/api/mocha#retries
*/
retries(n: number): this;
/**
* Set slowness threshold in milliseconds.
*
* @see https://mochajs.org/api/mocha#slow
*/
slow(slow: string | number): this;
/**
* Makes all tests async (accepting a callback)
*
* @see https://mochajs.org/api/mocha#asyncOnly.
*/
asyncOnly(): this;
/**
* Disable syntax highlighting (in browser).
*
* @see https://mochajs.org/api/mocha#noHighlighting
*/
noHighlighting(): this;
/**
* Enable uncaught errors to propagate (in browser).
*
* @see https://mochajs.org/api/mocha#allowUncaught
*/
allowUncaught(): boolean;
/**
* Delay root suite execution.
*
* @see https://mochajs.org/api/mocha#delay
*/
delay(): boolean;
/**
* Fails test run if no tests encountered with exit-code 1.
*
* @see https://mochajs.org/api/mocha#failZero
*/
failZero(failZero?: boolean): this;
/**
* Tests marked only fail the suite
*
* @see https://mochajs.org/api/mocha#forbidOnly
*/
forbidOnly(): boolean;
/**
* Pending tests and tests marked skip fail the suite
*
* @see https://mochajs.org/api/mocha#forbidPending
*/
forbidPending(): boolean;
/**
* Run tests and invoke `fn()` when complete.
*
* Note that `run` relies on Node's `require` to execute
* the test interface functions and will be subject to the
* cache - if the files are already in the `require` cache,
* they will effectively be skipped. Therefore, to run tests
* multiple times or to run tests in files that are already
* in the `require` cache, make sure to clear them from the
* cache first in whichever manner best suits your needs.
*
* @see https://mochajs.org/api/mocha#run
*/
run(fn?: (failures: number) => void): Mocha.Runner;
/**
* Loads ESM (and CJS) test files asynchronously.
*
* @see https://mochajs.org/api/mocha#loadFilesAsync
*/
loadFilesAsync(): Promise<void>;
/**
* Load registered files.
*
* @see https://mochajs.org/api/mocha#loadFiles
*/
protected loadFiles(fn?: () => void): void;
/**
* Unloads `files` from Node's `require` cache.
*
* This allows required files to be "freshly" reloaded, providing the ability
* to reuse a Mocha instance programmatically.
* Note: does not clear ESM module files from the cache
*/
unloadFiles(): this;
/**
* Toggles parallel mode.
*
* Must be run before calling `run`. Changes the `Runner` class to
* use; also enables lazy file loading if not already done so.
*
* @see https://mochajs.org/api/mocha#parallelMode
*/
parallelMode(enabled?: boolean): this;
/**
* Assigns hooks to the root suite.
*
* @see https://mochajs.org/api/mocha#rootHooks
*/
rootHooks(hooks: Mocha.RootHookObject): this;
/**
* Configures one or more global setup fixtures.
* If given no parameters, unsets any previously-set fixtures.
*
* @see https://mochajs.org/api/mocha#globalSetup
*/
globalSetup: Mocha.HookFunction;
/**
* Configures one or more global teardown fixtures.
* If given no parameters, unsets any previously-set fixtures.
*
* @see https://mochajs.org/api/mocha#globalTeardown
*/
globalTeardown: Mocha.HookFunction;
/**
* Returns `true` if one or more global setup fixtures have been supplied
*
* @see https://mochajs.org/api/mocha#hasGlobalSetupFixtures
*/
hasGlobalSetupFixtures(): boolean;
/**
* Returns `true` if one or more global teardown fixtures have been supplied
*
* @see https://mochajs.org/api/mocha#hasGlobalTeardownFixtures
*/
hasGlobalTeardownFixtures(): boolean;
/**
* Toggle execution of any global setup fixture(s)
*
* @see https://mochajs.org/api/mocha#enableGlobalSetup
*/
enableGlobalSetup(enabled: boolean): this;
/**
* Toggle execution of any global teardown fixture(s)
*
* @see https://mochajs.org/api/mocha#enableGlobalTeardown
*/
enableGlobalTeardown(enabled: boolean): this;
}
declare namespace Mocha {
namespace utils {
/**
* Compute a slug from the given `str`.
*
* @see https://mochajs.org/api/module-utils.html#.slug
*/
function slug(str: string): string;
/**
* Strip the function definition from `str`, and re-indent for pre whitespace.
*
* @see https://mochajs.org/api/module-utils.html#.clean
*/
function clean(str: string): string;
/**
* Highlight the given string of `js`.
*/
function highlight(js: string): string;
/**
* Takes some variable and asks `Object.prototype.toString()` what it thinks it is.
*/
function type(value: any): string;
/**
* Stringify `value`. Different behavior depending on type of value:
*
* - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.
* - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.
* - If `value` is an *empty* object, function, or array, returns `'{}'`, `'[Function]'`, or `'[]'` respectively.
* - If `value` has properties, call canonicalize} on it, then return result of `JSON.stringify()`
*
* @see https://mochajs.org/api/module-utils.html#.stringify
*/
function stringify(value: any): string;
/**
* Return a new Thing that has the keys in sorted order. Recursive.
*
* If the Thing...
* - has already been seen, return string `'[Circular]'`
* - is `undefined`, return string `'[undefined]'`
* - is `null`, return value `null`
* - is some other primitive, return the value
* - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method
* - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.
* - is an empty `Array`, `Object`, or `Function`, returns `'[]'`, `'{}'`, or `'[Function]'` respectively.
*
* @see https://mochajs.org/api/module-utils.html#.canonicalize
*/
function canonicalize(value: any, stack: any[], typeHint: string): any;
/**
* Generate an undefined error with a message warning the user.
*
* @see https://mochajs.org/api/module-utils.html#.undefinedError
*/
function undefinedError(): Error;
/**
* Generate an undefined error if `err` is not defined.
*
* @see https://mochajs.org/api/module-utils.html#.getError
*/
function getError(err: Error | undefined): Error;
/**
* When invoking this function you get a filter function that get the Error.stack as an
* input, and return a prettify output. (i.e: strip Mocha and internal node functions from
* stack trace).
*
* @see https://mochajs.org/api/module-utils.html#.stackTraceFilter
*/
function stackTraceFilter(): (stack: string) => string;
}
namespace interfaces {
function bdd(suite: Suite): void;
function tdd(suite: Suite): void;
function qunit(suite: Suite): void;
function exports(suite: Suite): void;
}
// #region Test interface augmentations
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
interface HookFunction<T extends void | Hook = void> {
/**
* [bdd, qunit, tdd] Describe a "hook" to execute the given callback `fn`. The name of the
* function is used as the name of the hook.
*
* - _Only available when invoked via the mocha CLI._
*/
(fn: Func): T;
/**
* [bdd, qunit, tdd] Describe a "hook" to execute the given callback `fn`. The name of the
* function is used as the name of the hook.
*
* - _Only available when invoked via the mocha CLI._
*/
(fn: AsyncFunc): T;
/**
* [bdd, qunit, tdd] Describe a "hook" to execute the given `title` and callback `fn`.
*
* - _Only available when invoked via the mocha CLI._
*/
(name: string, fn?: Func): T;
/**
* [bdd, qunit, tdd] Describe a "hook" to execute the given `title` and callback `fn`.
*
* - _Only available when invoked via the mocha CLI._
*/
(name: string, fn?: AsyncFunc): T;
}
interface SuiteFunction {
/**
* [bdd, tdd] Describe a "suite" with the given `title` and callback `fn` containing
* nested suites.
*
* - _Only available when invoked via the mocha CLI._
*/
(title: string, fn: (this: Suite) => void): Suite;
/**
* [qunit] Describe a "suite" with the given `title`.
*
* - _Only available when invoked via the mocha CLI._
*/
(title: string): Suite;
/**
* [bdd, tdd, qunit] Indicates this suite should be executed exclusively.
*
* - _Only available when invoked via the mocha CLI._
*/
only: ExclusiveSuiteFunction;
/**
* [bdd, tdd] Indicates this suite should not be executed.
*
* - _Only available when invoked via the mocha CLI._
*/
skip: PendingSuiteFunction;
}
interface ExclusiveSuiteFunction {
/**
* [bdd, tdd] Describe a "suite" with the given `title` and callback `fn` containing
* nested suites. Indicates this suite should be executed exclusively.
*
* - _Only available when invoked via the mocha CLI._
*/
(title: string, fn: (this: Suite) => void): Suite;
/**
* [qunit] Describe a "suite" with the given `title`. Indicates this suite should be executed
* exclusively.
*
* - _Only available when invoked via the mocha CLI._
*/
(title: string): Suite;
}
/**
* [bdd, tdd] Describe a "suite" with the given `title` and callback `fn` containing
* nested suites. Indicates this suite should not be executed.
*
* - _Only available when invoked via the mocha CLI._
*
* @returns [bdd] `Suite`
* @returns [tdd] `void`
*/
interface PendingSuiteFunction {
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
(title: string, fn: (this: Suite) => void): Suite | void;
}
interface TestFunction {
/**
* Describe a specification or test-case with the given callback `fn` acting as a thunk.
* The name of the function is used as the name of the test.
*
* - _Only available when invoked via the mocha CLI._
*/
(fn: Func): Test;
/**
* Describe a specification or test-case with the given callback `fn` acting as a thunk.
* The name of the function is used as the name of the test.
*
* - _Only available when invoked via the mocha CLI._
*/
(fn: AsyncFunc): Test;
/**
* Describe a specification or test-case with the given `title` and callback `fn` acting
* as a thunk.
*
* - _Only available when invoked via the mocha CLI._
*/
(title: string, fn?: Func): Test;
/**
* Describe a specification or test-case with the given `title` and callback `fn` acting
* as a thunk.
*
* - _Only available when invoked via the mocha CLI._
*/
(title: string, fn?: AsyncFunc): Test;
/**
* Indicates this test should be executed exclusively.
*
* - _Only available when invoked via the mocha CLI._
*/
only: ExclusiveTestFunction;
/**
* Indicates this test should not be executed.
*
* - _Only available when invoked via the mocha CLI._
*/
skip: PendingTestFunction;
/**
* Number of attempts to retry.
*
* - _Only available when invoked via the mocha CLI._
*/
retries(n: number): void;
}
interface ExclusiveTestFunction {
/**
* [bdd, tdd, qunit] Describe a specification or test-case with the given callback `fn`
* acting as a thunk. The name of the function is used as the name of the test. Indicates
* this test should be executed exclusively.
*
* - _Only available when invoked via the mocha CLI._
*/
(fn: Func): Test;
/**
* [bdd, tdd, qunit] Describe a specification or test-case with the given callback `fn`
* acting as a thunk. The name of the function is used as the name of the test. Indicates
* this test should be executed exclusively.
*
* - _Only available when invoked via the mocha CLI._
*/
(fn: AsyncFunc): Test;
/**
* [bdd, tdd, qunit] Describe a specification or test-case with the given `title` and
* callback `fn` acting as a thunk. Indicates this test should be executed exclusively.
*
* - _Only available when invoked via the mocha CLI._
*/
(title: string, fn?: Func): Test;
/**
* [bdd, tdd, qunit] Describe a specification or test-case with the given `title` and
* callback `fn` acting as a thunk. Indicates this test should be executed exclusively.
*
* - _Only available when invoked via the mocha CLI._
*/
(title: string, fn?: AsyncFunc): Test;
}
interface PendingTestFunction {
/**
* [bdd, tdd, qunit] Describe a specification or test-case with the given callback `fn`
* acting as a thunk. The name of the function is used as the name of the test. Indicates
* this test should not be executed.
*
* - _Only available when invoked via the mocha CLI._
*/
(fn: Func): Test;
/**
* [bdd, tdd, qunit] Describe a specification or test-case with the given callback `fn`
* acting as a thunk. The name of the function is used as the name of the test. Indicates
* this test should not be executed.
*
* - _Only available when invoked via the mocha CLI._
*/
(fn: AsyncFunc): Test;
/**
* [bdd, tdd, qunit] Describe a specification or test-case with the given `title` and
* callback `fn` acting as a thunk. Indicates this test should not be executed.
*
* - _Only available when invoked via the mocha CLI._
*/
(title: string, fn?: Func): Test;
/**
* [bdd, tdd, qunit] Describe a specification or test-case with the given `title` and
* callback `fn` acting as a thunk. Indicates this test should not be executed.
*
* - _Only available when invoked via the mocha CLI._
*/
(title: string, fn?: AsyncFunc): Test;
}
/**
* Execute after each test case.
*
* - _Only available when invoked via the mocha CLI._
*
* @see https://mochajs.org/api/global.html#afterEach
*/
let afterEach: HookFunction<Hook>;
/**
* Execute after running tests.
*
* - _Only available when invoked via the mocha CLI._
*
* @see https://mochajs.org/api/global.html#after
*/
let after: HookFunction<Hook>;
/**
* Execute before each test case.
*
* - _Only available when invoked via the mocha CLI._
*
* @see https://mochajs.org/api/global.html#beforeEach
*/
let beforeEach: HookFunction<Hook>;
/**
* Execute before running tests.
*
* - _Only available when invoked via the mocha CLI._
*
* @see https://mochajs.org/api/global.html#before
*/
let before: HookFunction<Hook>;
/**
* Describe a "suite" containing nested suites and tests.
*
* - _Only available when invoked via the mocha CLI._
*/
let describe: SuiteFunction;
/**
* Describe a pending suite.
*
* - _Only available when invoked via the mocha CLI._
*/
let xdescribe: PendingSuiteFunction;
/**
* Describes a test case.
*
* - _Only available when invoked via the mocha CLI._
*/
let it: TestFunction;
/**
* Describes a pending test case.
*
* - _Only available when invoked via the mocha CLI._
*/
let xit: PendingTestFunction;
/**
* Execute before each test case.
*
* - _Only available when invoked via the mocha CLI._
*
* @see https://mochajs.org/api/global.html#beforeEach
*/
let setup: HookFunction;
/**
* Execute before running tests.
*
* - _Only available when invoked via the mocha CLI._
*
* @see https://mochajs.org/api/global.html#before
*/
let suiteSetup: HookFunction;
/**
* Execute after running tests.
*
* - _Only available when invoked via the mocha CLI._
*
* @see https://mochajs.org/api/global.html#after
*/
let suiteTeardown: HookFunction;
/**
* Describe a "suite" containing nested suites and tests.
*
* - _Only available when invoked via the mocha CLI._
*/
let suite: SuiteFunction;
/**
* Execute after each test case.
*
* - _Only available when invoked via the mocha CLI._
*
* @see https://mochajs.org/api/global.html#afterEach
*/
let teardown: HookFunction;
/**
* Describes a test case.
*
* - _Only available when invoked via the mocha CLI._
*/
let test: TestFunction;
/**
* Triggers root suite execution.
*
* - _Only available if flag --delay is passed into Mocha._
* - _Only available when invoked via the mocha CLI._
*
* @see https://mochajs.org/api/global.html#runWithSuite
*/
function run(): void;
// #endregion Test interface augmentations
namespace reporters {
/**
* Initialize a new `Base` reporter.
*
* All other reporters generally inherit from this reporter, providing stats such as test duration,
* number of tests passed / failed, etc.
*
* @see https://mochajs.org/api/Mocha.reporters.Base.html
*/
class Base {
constructor(runner: Runner, options?: MochaOptions);
/**
* Test run statistics
*/
stats: Stats;
/**
* Test failures
*/
failures: Test[];
/**
* The configured runner
*/
runner: Runner;
/**
* Output common epilogue used by many of the bundled reporters.
*
* @see https://mochajs.org/api/Mocha.reporters.Base.html#.Base#epilogue
*/
epilogue(): void;
done?(failures: number, fn?: (failures: number) => void): void;
static consoleLog: (...data: any[]) => void;
}
namespace Base {
/**
* Enables coloring by default
*
* @see https://mochajs.org/api/module-base#.useColors
*/
let useColors: boolean;
/**
* Inline diffs instead of +/-
*
* @see https://mochajs.org/api/module-base#.inlineDiffs
*/
let inlineDiffs: boolean;
/**
* Default color map
*
* @see https://mochajs.org/api/module-base#.colors
*/
const colors: ColorMap;
/**
* Default color map
*
* @see https://mochajs.org/api/module-base#.colors
*/
interface ColorMap {
// added by Base
pass: number;
fail: number;
"bright pass": number;
"bright fail": number;
"bright yellow": number;
pending: number;
suite: number;
"error title": number;
"error message": number;
"error stack": number;
checkmark: number;
fast: number;
medium: number;
slow: number;
green: number;
light: number;
"diff gutter": number;
"diff added": number;
"diff removed": number;
// added by Progress
progress: number;
// added by Landing
plane: number;
"plane crash": number;
runway: number;
[key: string]: number;
}
/**
* Default symbol map
*
* @see https://mochajs.org/api/module-base#.symbols
*/
const symbols: SymbolMap;
/**
* Default symbol map
*
* @see https://mochajs.org/api/module-base#.symbols
*/
interface SymbolMap {
ok: string;
err: string;
dot: string;
comma: string;
bang: string;
[key: string]: string;
}
/**
* Color `str` with the given `type` (from `colors`)
*
* @see https://mochajs.org/api/module-base#.color
*/
function color(type: string, str: string): string;
/**
* Expose terminal window size
*
* @see https://mochajs.org/api/module-base#.window
*/
const window: {
width: number;
};
/**
* ANSI TTY control sequences common among reporters.
*
* @see https://mochajs.org/api/module-base#.cursor
*/
namespace cursor {
/**
* Hides the cursor
*/
function hide(): void;
/**
* Shows the cursor
*/
function show(): void;
/**
* Deletes the current line
*/
function deleteLine(): void;
/**
* Moves to the beginning of the line
*/
function beginningOfLine(): void;
/**
* Clears the line and moves to the beginning of the line.
*/
function CR(): void;
}
/**
* Returns a diff between two strings with colored ANSI output.
*
* @see https://mochajs.org/api/module-base#.generateDiff
*/
function generateDiff(actual: string, expected: string): string;
/**
* Output the given `failures` as a list.
*
* @see https://mochajs.org/api/Mocha.reporters.Base.html#.exports.list1
*/
function list(failures: Test[]): void;
}
/**
* Initialize a new `Dot` matrix test reporter.
*
* @see https://mochajs.org/api/Mocha.reporters.Dot.html
*/
class Dot extends Base {}
/**
* Initialize a new `Doc` reporter.
*
* @see https://mochajs.org/api/Mocha.reporters.Doc.html
*/
class Doc extends Base {}
/**
* Initialize a new `TAP` test reporter.
*
* @see https://mochajs.org/api/Mocha.reporters.TAP.html
*/
class TAP extends Base {}
/**
* Initialize a new `JSON` reporter
*
* @see https://mochajs.org/api/Mocha.reporters.JSON.html
*/
class JSON extends Base {}
/**
* Initialize a new `HTML` reporter.
*
* - _This reporter cannot be used on the console._
*
* @see https://mochajs.org/api/Mocha.reporters.HTML.html
*/
class HTML extends Base {
/**
* Provide suite URL.
*
* @see https://mochajs.org/api/Mocha.reporters.HTML.html#suiteURL
*/
suiteURL(suite: Suite): string;
/**
* Provide test URL.
*
* @see https://mochajs.org/api/Mocha.reporters.HTML.html#testURL
*/
testURL(test: Test): string;
/**
* Adds code toggle functionality for the provided test's list element.
*
* @see https://mochajs.org/api/Mocha.reporters.HTML.html#addCodeToggle
*/
addCodeToggle(el: HTMLLIElement, contents: string): void;
}
/**
* Initialize a new `List` test reporter.
*
* @see https://mochajs.org/api/Mocha.reporters.List.html
*/
class List extends Base {}
/**
* Initialize a new `Min` minimal test reporter (best used with --watch).
*
* @see https://mochajs.org/api/Mocha.reporters.Min.html
*/
class Min extends Base {}
/**
* Initialize a new `Spec` test reporter.
*
* @see https://mochajs.org/api/Mocha.reporters.Spec.html
*/
class Spec extends Base {}