cypress 5.1.0 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +6 -6
- package/lib/cli.js +114 -107
- package/lib/cypress.js +21 -21
- package/lib/errors.js +233 -276
- package/lib/exec/info.js +29 -32
- package/lib/exec/open.js +7 -8
- package/lib/exec/run.js +20 -20
- package/lib/exec/spawn.js +53 -49
- package/lib/exec/versions.js +18 -17
- package/lib/exec/xvfb.js +43 -37
- package/lib/fs.js +1 -1
- package/lib/logger.js +24 -50
- package/lib/tasks/cache.js +96 -36
- package/lib/tasks/download.js +113 -133
- package/lib/tasks/get-folder-size.js +41 -0
- package/lib/tasks/install.js +225 -161
- package/lib/tasks/state.js +54 -56
- package/lib/tasks/unzip.js +72 -69
- package/lib/tasks/verify.js +112 -147
- package/lib/util.js +172 -176
- package/package.json +3 -3
- package/types/cypress-npm-api.d.ts +13 -5
- package/types/cypress.d.ts +51 -48
- package/types/mocha/index.d.ts +123 -308
- package/types/net-stubbing.ts +169 -19
package/types/mocha/index.d.ts
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
// Type definitions for mocha
|
1
|
+
// Type definitions for mocha 8.0
|
2
2
|
// Project: https://mochajs.org
|
3
3
|
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid>
|
4
4
|
// otiai10 <https://github.com/otiai10>
|
5
|
-
// jt000 <https://github.com/jt000>
|
6
5
|
// Vadim Macagon <https://github.com/enlight>
|
7
6
|
// Andrew Bradley <https://github.com/cspotcode>
|
8
7
|
// Dmitrii Sorin <https://github.com/1999>
|
@@ -90,13 +89,6 @@ declare class Mocha {
|
|
90
89
|
*/
|
91
90
|
invert(): this;
|
92
91
|
|
93
|
-
/**
|
94
|
-
* Ignore global leaks.
|
95
|
-
*
|
96
|
-
* @see https://mochajs.org/api/mocha#ignoreLeaks
|
97
|
-
*/
|
98
|
-
ignoreLeaks(ignore: boolean): this;
|
99
|
-
|
100
92
|
/**
|
101
93
|
* Enable global leak checking.
|
102
94
|
*
|
@@ -125,27 +117,6 @@ declare class Mocha {
|
|
125
117
|
*/
|
126
118
|
globals(globals: string | ReadonlyArray<string>): this;
|
127
119
|
|
128
|
-
/**
|
129
|
-
* Emit color output.
|
130
|
-
*
|
131
|
-
* @see https://mochajs.org/api/mocha#useColors
|
132
|
-
*/
|
133
|
-
useColors(colors: boolean): this;
|
134
|
-
|
135
|
-
/**
|
136
|
-
* Use inline diffs rather than +/-.
|
137
|
-
*
|
138
|
-
* @see https://mochajs.org/api/mocha#useInlineDiffs
|
139
|
-
*/
|
140
|
-
useInlineDiffs(inlineDiffs: boolean): this;
|
141
|
-
|
142
|
-
/**
|
143
|
-
* Do not show diffs at all.
|
144
|
-
*
|
145
|
-
* @see https://mochajs.org/api/mocha#hideDiff
|
146
|
-
*/
|
147
|
-
hideDiff(hideDiff: boolean): this;
|
148
|
-
|
149
120
|
/**
|
150
121
|
* Set the timeout in milliseconds.
|
151
122
|
*
|
@@ -167,13 +138,6 @@ declare class Mocha {
|
|
167
138
|
*/
|
168
139
|
slow(slow: string | number): this;
|
169
140
|
|
170
|
-
/**
|
171
|
-
* Enable timeouts.
|
172
|
-
*
|
173
|
-
* @see https://mochajs.org/api/mocha#enableTimeouts
|
174
|
-
*/
|
175
|
-
enableTimeouts(enabled?: boolean): this;
|
176
|
-
|
177
141
|
/**
|
178
142
|
* Makes all tests async (accepting a callback)
|
179
143
|
*
|
@@ -231,12 +195,45 @@ declare class Mocha {
|
|
231
195
|
*/
|
232
196
|
run(fn?: (failures: number) => void): Mocha.Runner;
|
233
197
|
|
198
|
+
/**
|
199
|
+
* Loads ESM (and CJS) test files asynchronously.
|
200
|
+
*
|
201
|
+
* @see https://mochajs.org/api/mocha#loadFilesAsync
|
202
|
+
*/
|
203
|
+
loadFilesAsync(): Promise<void>;
|
204
|
+
|
234
205
|
/**
|
235
206
|
* Load registered files.
|
236
207
|
*
|
237
208
|
* @see https://mochajs.org/api/mocha#loadFiles
|
238
209
|
*/
|
239
210
|
protected loadFiles(fn?: () => void): void;
|
211
|
+
|
212
|
+
/**
|
213
|
+
* Unloads `files` from Node's `require` cache.
|
214
|
+
*
|
215
|
+
* This allows required files to be "freshly" reloaded, providing the ability
|
216
|
+
* to reuse a Mocha instance programmatically.
|
217
|
+
* Note: does not clear ESM module files from the cache
|
218
|
+
*/
|
219
|
+
unloadFiles(): this;
|
220
|
+
|
221
|
+
/**
|
222
|
+
* Toggles parallel mode.
|
223
|
+
*
|
224
|
+
* Must be run before calling `run`. Changes the `Runner` class to
|
225
|
+
* use; also enables lazy file loading if not already done so.
|
226
|
+
*
|
227
|
+
* @see https://mochajs.org/api/mocha#parallelMode
|
228
|
+
*/
|
229
|
+
parallelMode(enabled?: boolean): this;
|
230
|
+
|
231
|
+
/**
|
232
|
+
* Assigns hooks to the root suite.
|
233
|
+
*
|
234
|
+
* @see https://mochajs.org/api/mocha#rootHooks
|
235
|
+
*/
|
236
|
+
rootHooks(hooks: Mocha.RootHookObject): this;
|
240
237
|
}
|
241
238
|
|
242
239
|
declare namespace Mocha {
|
@@ -684,8 +681,6 @@ declare namespace Mocha {
|
|
684
681
|
*/
|
685
682
|
class Base {
|
686
683
|
constructor(runner: Runner, options?: MochaOptions);
|
687
|
-
/** @deprecated Use the overload that accepts `Mocha.Runner` instead. */
|
688
|
-
constructor(runner: IRunner, options?: MochaOptions);
|
689
684
|
|
690
685
|
/**
|
691
686
|
* Test run statistics
|
@@ -974,8 +969,6 @@ declare namespace Mocha {
|
|
974
969
|
*/
|
975
970
|
class XUnit extends Base {
|
976
971
|
constructor(runner: Runner, options?: XUnit.MochaOptions);
|
977
|
-
/** @deprecated Use the overload that accepts `Mocha.Runner` instead. */
|
978
|
-
constructor(runner: IRunner, options?: XUnit.MochaOptions);
|
979
972
|
|
980
973
|
/**
|
981
974
|
* Override done to close the stream (if it's a file).
|
@@ -1025,8 +1018,6 @@ declare namespace Mocha {
|
|
1025
1018
|
*/
|
1026
1019
|
class Progress extends Base {
|
1027
1020
|
constructor(runner: Runner, options?: Progress.MochaOptions);
|
1028
|
-
/** @deprecated Use the overload that accepts `Mocha.Runner` instead. */
|
1029
|
-
constructor(runner: IRunner, options?: Progress.MochaOptions);
|
1030
1021
|
}
|
1031
1022
|
|
1032
1023
|
namespace Progress {
|
@@ -1084,7 +1075,6 @@ declare namespace Mocha {
|
|
1084
1075
|
*/
|
1085
1076
|
class Runnable {
|
1086
1077
|
private _slow;
|
1087
|
-
private _enableTimeouts;
|
1088
1078
|
private _retries;
|
1089
1079
|
private _currentRetry;
|
1090
1080
|
private _timeout;
|
@@ -1136,20 +1126,6 @@ declare namespace Mocha {
|
|
1136
1126
|
*/
|
1137
1127
|
slow(ms: string | number): this;
|
1138
1128
|
|
1139
|
-
/**
|
1140
|
-
* Get whether timeouts are enabled.
|
1141
|
-
*
|
1142
|
-
* @see https://mochajs.org/api/Runnable.html#enableTimeouts
|
1143
|
-
*/
|
1144
|
-
enableTimeouts(): boolean;
|
1145
|
-
|
1146
|
-
/**
|
1147
|
-
* Set whether timeouts are enabled.
|
1148
|
-
*
|
1149
|
-
* @see https://mochajs.org/api/Runnable.html#enableTimeouts
|
1150
|
-
*/
|
1151
|
-
enableTimeouts(enabled: boolean): this;
|
1152
|
-
|
1153
1129
|
/**
|
1154
1130
|
* Halt and mark as pending.
|
1155
1131
|
*/
|
@@ -1296,8 +1272,6 @@ declare namespace Mocha {
|
|
1296
1272
|
* Set the context `Runnable`.
|
1297
1273
|
*/
|
1298
1274
|
runnable(runnable: Runnable): this;
|
1299
|
-
/** @deprecated Use the overload that accepts `Mocha.Runnable` instead. */
|
1300
|
-
runnable(runnable: IRunnable): this;
|
1301
1275
|
|
1302
1276
|
/**
|
1303
1277
|
* Get test timeout.
|
@@ -1309,16 +1283,6 @@ declare namespace Mocha {
|
|
1309
1283
|
*/
|
1310
1284
|
timeout(ms: string | number): this;
|
1311
1285
|
|
1312
|
-
/**
|
1313
|
-
* Get whether timeouts are enabled.
|
1314
|
-
*/
|
1315
|
-
enableTimeouts(): boolean;
|
1316
|
-
|
1317
|
-
/**
|
1318
|
-
* Set whether timeouts are enabled.
|
1319
|
-
*/
|
1320
|
-
enableTimeouts(enabled: boolean): this;
|
1321
|
-
|
1322
1286
|
/**
|
1323
1287
|
* Get test slowness threshold.
|
1324
1288
|
*/
|
@@ -1347,6 +1311,23 @@ declare namespace Mocha {
|
|
1347
1311
|
[key: string]: any;
|
1348
1312
|
}
|
1349
1313
|
|
1314
|
+
interface RunnerConstants {
|
1315
|
+
readonly EVENT_HOOK_BEGIN: 'hook';
|
1316
|
+
readonly EVENT_HOOK_END: 'hook end';
|
1317
|
+
readonly EVENT_RUN_BEGIN: 'start';
|
1318
|
+
readonly EVENT_DELAY_BEGIN: 'waiting';
|
1319
|
+
readonly EVENT_DELAY_END: 'ready';
|
1320
|
+
readonly EVENT_RUN_END: 'end';
|
1321
|
+
readonly EVENT_SUITE_BEGIN: 'suite';
|
1322
|
+
readonly EVENT_SUITE_END: 'suite end';
|
1323
|
+
readonly EVENT_TEST_BEGIN: 'test';
|
1324
|
+
readonly EVENT_TEST_END: 'test end';
|
1325
|
+
readonly EVENT_TEST_FAIL: 'fail';
|
1326
|
+
readonly EVENT_TEST_PASS: 'pass';
|
1327
|
+
readonly EVENT_TEST_PENDING: 'pending';
|
1328
|
+
readonly EVENT_TEST_RETRY: 'retry';
|
1329
|
+
}
|
1330
|
+
|
1350
1331
|
/**
|
1351
1332
|
* Initialize a `Runner` for the given `suite`.
|
1352
1333
|
*
|
@@ -1362,10 +1343,9 @@ declare namespace Mocha {
|
|
1362
1343
|
private prevGlobalsLength;
|
1363
1344
|
private nextSuite;
|
1364
1345
|
|
1365
|
-
|
1346
|
+
static readonly constants: RunnerConstants;
|
1366
1347
|
|
1367
|
-
|
1368
|
-
constructor(suite: ISuite, delay: boolean);
|
1348
|
+
constructor(suite: Suite, delay: boolean);
|
1369
1349
|
|
1370
1350
|
suite: Suite;
|
1371
1351
|
started: boolean;
|
@@ -1376,7 +1356,7 @@ declare namespace Mocha {
|
|
1376
1356
|
fullStackTrace?: boolean;
|
1377
1357
|
forbidOnly?: boolean;
|
1378
1358
|
forbidPending?: boolean;
|
1379
|
-
|
1359
|
+
checkLeaks?: boolean;
|
1380
1360
|
test?: Test;
|
1381
1361
|
currentRunnable?: Runnable;
|
1382
1362
|
stats?: Stats; // added by reporters
|
@@ -1397,9 +1377,6 @@ declare namespace Mocha {
|
|
1397
1377
|
*/
|
1398
1378
|
grepTotal(suite: Suite): number;
|
1399
1379
|
|
1400
|
-
/** @deprecated Use the overload that accepts `Mocha.Suite` instead. */
|
1401
|
-
grepTotal(suite: ISuite): number;
|
1402
|
-
|
1403
1380
|
/**
|
1404
1381
|
* Gets the allowed globals.
|
1405
1382
|
*
|
@@ -1683,6 +1660,25 @@ declare namespace Mocha {
|
|
1683
1660
|
}
|
1684
1661
|
// #endregion Runner untyped events
|
1685
1662
|
|
1663
|
+
interface SuiteConstants {
|
1664
|
+
readonly EVENT_FILE_POST_REQUIRE: 'post-require';
|
1665
|
+
readonly EVENT_FILE_PRE_REQUIRE: 'pre-require';
|
1666
|
+
readonly EVENT_FILE_REQUIRE: 'require';
|
1667
|
+
readonly EVENT_ROOT_SUITE_RUN: 'run';
|
1668
|
+
|
1669
|
+
readonly HOOK_TYPE_AFTER_ALL: 'afterAll';
|
1670
|
+
readonly HOOK_TYPE_AFTER_EACH: 'afterEach';
|
1671
|
+
readonly HOOK_TYPE_BEFORE_ALL: 'beforeAll';
|
1672
|
+
readonly HOOK_TYPE_BEFORE_EACH: 'beforeEach';
|
1673
|
+
|
1674
|
+
readonly EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll';
|
1675
|
+
readonly EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach';
|
1676
|
+
readonly EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll';
|
1677
|
+
readonly EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach';
|
1678
|
+
readonly EVENT_SUITE_ADD_SUITE: 'suite';
|
1679
|
+
readonly EVENT_SUITE_ADD_TEST: 'test';
|
1680
|
+
}
|
1681
|
+
|
1686
1682
|
/**
|
1687
1683
|
* Initialize a new `Suite` with the given `title` and `ctx`.
|
1688
1684
|
*
|
@@ -1694,16 +1690,15 @@ declare namespace Mocha {
|
|
1694
1690
|
private _afterEach;
|
1695
1691
|
private _afterAll;
|
1696
1692
|
private _timeout;
|
1697
|
-
private _enableTimeouts;
|
1698
1693
|
private _slow;
|
1699
1694
|
private _bail;
|
1700
1695
|
private _retries;
|
1701
1696
|
private _onlyTests;
|
1702
1697
|
private _onlySuites;
|
1703
1698
|
|
1699
|
+
static readonly constants: SuiteConstants;
|
1700
|
+
|
1704
1701
|
constructor(title: string, parentContext?: Context);
|
1705
|
-
/** @deprecated Use the overload that accepts `Mocha.Context` instead. */
|
1706
|
-
constructor(title: string, parentContext?: IContext);
|
1707
1702
|
|
1708
1703
|
ctx: Context;
|
1709
1704
|
suites: Suite[];
|
@@ -1723,8 +1718,6 @@ declare namespace Mocha {
|
|
1723
1718
|
* @see https://mochajs.org/api/mocha#.exports.create
|
1724
1719
|
*/
|
1725
1720
|
static create(parent: Suite, title: string): Suite;
|
1726
|
-
/** @deprecated Use the overload that accepts `Mocha.Suite` instead. */
|
1727
|
-
static create(parent: ISuite, title: string): Suite;
|
1728
1721
|
|
1729
1722
|
/**
|
1730
1723
|
* Return a clone of this `Suite`.
|
@@ -1761,20 +1754,6 @@ declare namespace Mocha {
|
|
1761
1754
|
*/
|
1762
1755
|
retries(n: string | number): this;
|
1763
1756
|
|
1764
|
-
/**
|
1765
|
-
* Get whether timeouts are enabled.
|
1766
|
-
*
|
1767
|
-
* @see https://mochajs.org/api/Mocha.Suite.html#enableTimeouts
|
1768
|
-
*/
|
1769
|
-
enableTimeouts(): boolean;
|
1770
|
-
|
1771
|
-
/**
|
1772
|
-
* Set whether timeouts are `enabled`.
|
1773
|
-
*
|
1774
|
-
* @see https://mochajs.org/api/Mocha.Suite.html#enableTimeouts
|
1775
|
-
*/
|
1776
|
-
enableTimeouts(enabled: boolean): this;
|
1777
|
-
|
1778
1757
|
/**
|
1779
1758
|
* Get slow `ms`.
|
1780
1759
|
*
|
@@ -1928,8 +1907,6 @@ declare namespace Mocha {
|
|
1928
1907
|
* @see https://mochajs.org/api/Mocha.Suite.html#addSuite
|
1929
1908
|
*/
|
1930
1909
|
addSuite(suite: Suite): this;
|
1931
|
-
/** @deprecated Use the overload that accepts `Mocha.ISuite` instead. */
|
1932
|
-
addSuite(suite: ISuite): this;
|
1933
1910
|
|
1934
1911
|
/**
|
1935
1912
|
* Add a `test` to this suite.
|
@@ -1937,8 +1914,6 @@ declare namespace Mocha {
|
|
1937
1914
|
* @see https://mochajs.org/api/Mocha.Suite.html#addTest
|
1938
1915
|
*/
|
1939
1916
|
addTest(test: Test): this;
|
1940
|
-
/** @deprecated Use the overload that accepts `Mocha.ITest` instead. */
|
1941
|
-
addTest(test: ITest): this;
|
1942
1917
|
|
1943
1918
|
/**
|
1944
1919
|
* Return the full title generated by recursively concatenating the parent's
|
@@ -2132,6 +2107,37 @@ declare namespace Mocha {
|
|
2132
2107
|
error(err: any): void;
|
2133
2108
|
}
|
2134
2109
|
|
2110
|
+
/**
|
2111
|
+
* An alternative way to define root hooks that works with parallel runs.
|
2112
|
+
*
|
2113
|
+
* Root hooks work with any interface, but the property names do not change.
|
2114
|
+
* In other words, if you are using the tdd interface, suiteSetup maps to beforeAll, and setup maps to beforeEach.
|
2115
|
+
*
|
2116
|
+
* As with other hooks, `this` refers to to the current context object.
|
2117
|
+
*
|
2118
|
+
* @see https://mochajs.org/#root-hook-plugins
|
2119
|
+
*/
|
2120
|
+
interface RootHookObject {
|
2121
|
+
/**
|
2122
|
+
* In serial mode, run after all tests end, once only.
|
2123
|
+
* In parallel mode, run after all tests end, for each file.
|
2124
|
+
*/
|
2125
|
+
afterAll?: Func | AsyncFunc | Func[] | AsyncFunc[];
|
2126
|
+
/**
|
2127
|
+
* In serial mode (Mocha's default), before all tests begin, once only.
|
2128
|
+
* In parallel mode, run before all tests begin, for each file.
|
2129
|
+
*/
|
2130
|
+
beforeAll?: Func | AsyncFunc | Func[] | AsyncFunc[];
|
2131
|
+
/**
|
2132
|
+
* In both modes, run after every test.
|
2133
|
+
*/
|
2134
|
+
afterEach?: Func | AsyncFunc | Func[] | AsyncFunc[];
|
2135
|
+
/**
|
2136
|
+
* In both modes, run before each test.
|
2137
|
+
*/
|
2138
|
+
beforeEach?: Func | AsyncFunc | Func[] | AsyncFunc[];
|
2139
|
+
}
|
2140
|
+
|
2135
2141
|
/**
|
2136
2142
|
* Initialize a new `Test` with the given `title` and callback `fn`.
|
2137
2143
|
*
|
@@ -2195,10 +2201,8 @@ declare namespace Mocha {
|
|
2195
2201
|
/** Array of accepted globals. */
|
2196
2202
|
globals?: string[];
|
2197
2203
|
|
2198
|
-
/** timeout in milliseconds. */
|
2199
|
-
timeout?: number;
|
2200
|
-
|
2201
|
-
enableTimeouts?: boolean;
|
2204
|
+
/** timeout in milliseconds or time string like '1s'. */
|
2205
|
+
timeout?: number | string;
|
2202
2206
|
|
2203
2207
|
/** number of times to retry failed tests. */
|
2204
2208
|
retries?: number;
|
@@ -2209,8 +2213,8 @@ declare namespace Mocha {
|
|
2209
2213
|
/** milliseconds to wait before considering a test slow. */
|
2210
2214
|
slow?: number;
|
2211
2215
|
|
2212
|
-
/**
|
2213
|
-
|
2216
|
+
/** check for global variable leaks. */
|
2217
|
+
checkLeaks?: boolean;
|
2214
2218
|
|
2215
2219
|
/** display the full stack trace on failure. */
|
2216
2220
|
fullStackTrace?: boolean;
|
@@ -2221,8 +2225,8 @@ declare namespace Mocha {
|
|
2221
2225
|
/** Enable growl support. */
|
2222
2226
|
growl?: boolean;
|
2223
2227
|
|
2224
|
-
/**
|
2225
|
-
|
2228
|
+
/** Color TTY output from reporter */
|
2229
|
+
color?: boolean;
|
2226
2230
|
|
2227
2231
|
/** Use inline diffs rather than +/-. */
|
2228
2232
|
inlineDiffs?: boolean;
|
@@ -2230,12 +2234,22 @@ declare namespace Mocha {
|
|
2230
2234
|
/** Do not show diffs at all. */
|
2231
2235
|
hideDiff?: boolean;
|
2232
2236
|
|
2237
|
+
/** Run job in parallel */
|
2238
|
+
parallel?: boolean;
|
2239
|
+
|
2240
|
+
/** Max number of worker processes for parallel runs */
|
2241
|
+
jobs?: number;
|
2242
|
+
|
2243
|
+
/** Assigns hooks to the root suite */
|
2244
|
+
rootHooks?: RootHookObject;
|
2245
|
+
|
2233
2246
|
asyncOnly?: boolean;
|
2234
2247
|
delay?: boolean;
|
2235
2248
|
forbidOnly?: boolean;
|
2236
2249
|
forbidPending?: boolean;
|
2237
2250
|
noHighlighting?: boolean;
|
2238
2251
|
allowUncaught?: boolean;
|
2252
|
+
fullTrace?: boolean;
|
2239
2253
|
}
|
2240
2254
|
|
2241
2255
|
interface MochaInstanceOptions extends MochaOptions {
|
@@ -2440,186 +2454,6 @@ declare namespace Mocha {
|
|
2440
2454
|
}
|
2441
2455
|
|
2442
2456
|
type Interface = keyof InterfaceContributions;
|
2443
|
-
|
2444
|
-
// #region Deprecations
|
2445
|
-
|
2446
|
-
/** @deprecated use `Mocha.Context` instead. */
|
2447
|
-
interface IContext {
|
2448
|
-
test?: IRunnable;
|
2449
|
-
runnable(): IRunnable | undefined;
|
2450
|
-
/** @deprecated `.runnable()` returns `this` in `Mocha.Context`. */
|
2451
|
-
runnable(runnable: IRunnable): IContext;
|
2452
|
-
timeout(): number;
|
2453
|
-
/** @deprecated `.timeout()` returns `this` in `Mocha.Context`. */
|
2454
|
-
timeout(timeout: number): IContext;
|
2455
|
-
/** @deprecated `.enableTimeouts()` has additional overloads in `Mocha.Context`. */
|
2456
|
-
/** @deprecated `.enableTimeouts()` returns `this` in `Mocha.Context`. */
|
2457
|
-
enableTimeouts(enableTimeouts: boolean): IContext;
|
2458
|
-
/** @deprecated `.slow()` has additional overloads in `Mocha.Context`. */
|
2459
|
-
/** @deprecated `.slow()` returns `this` in `Mocha.Context`. */
|
2460
|
-
slow(slow: number): IContext;
|
2461
|
-
/** @deprecated `.skip()` returns `never` in `Mocha.Context`. */
|
2462
|
-
skip(): IContext;
|
2463
|
-
retries(): number;
|
2464
|
-
/** @deprecated `.retries()` returns `this` in `Mocha.Context`. */
|
2465
|
-
retries(retries: number): IContext;
|
2466
|
-
}
|
2467
|
-
|
2468
|
-
/** @deprecated use `Mocha.Suite` instead. */
|
2469
|
-
interface ISuiteCallbackContext {
|
2470
|
-
/** @deprecated `.timeout()` has additional overloads in `Mocha.Suite`. */
|
2471
|
-
timeout(ms: number | string): this;
|
2472
|
-
/** @deprecated `.retries()` has additional overloads in `Mocha.Suite`. */
|
2473
|
-
retries(n: number): this;
|
2474
|
-
/** @deprecated `.slow()` has additional overloads in `Mocha.Suite`. */
|
2475
|
-
slow(ms: number): this;
|
2476
|
-
}
|
2477
|
-
|
2478
|
-
/** @deprecated use `Mocha.Context` instead. */
|
2479
|
-
interface IHookCallbackContext {
|
2480
|
-
/** @deprecated `.skip()` returns `never` in `Mocha.Context`. */
|
2481
|
-
skip(): this;
|
2482
|
-
/** @deprecated `.timeout()` has additional overloads in `Mocha.Context`. */
|
2483
|
-
timeout(ms: number | string): this;
|
2484
|
-
[index: string]: any;
|
2485
|
-
}
|
2486
|
-
|
2487
|
-
/** @deprecated use `Mocha.Context` instead. */
|
2488
|
-
interface ITestCallbackContext {
|
2489
|
-
/** @deprecated `.skip()` returns `never` in `Mocha.Context`. */
|
2490
|
-
skip(): this;
|
2491
|
-
/** @deprecated `.timeout()` has additional overloads in `Mocha.Context`. */
|
2492
|
-
timeout(ms: number | string): this;
|
2493
|
-
/** @deprecated `.retries()` has additional overloads in `Mocha.Context`. */
|
2494
|
-
retries(n: number): this;
|
2495
|
-
/** @deprecated `.slow()` has additional overloads in `Mocha.Context`. */
|
2496
|
-
slow(ms: number): this;
|
2497
|
-
[index: string]: any;
|
2498
|
-
}
|
2499
|
-
|
2500
|
-
/** Partial interface for Mocha's `Runnable` class. */
|
2501
|
-
/** @deprecated use `Mocha.Runnable` instead. */
|
2502
|
-
interface IRunnable extends NodeJS.EventEmitter {
|
2503
|
-
title: string;
|
2504
|
-
/** @deprecated `.fn` has type `Func | AsyncFunc` in `Mocha.Runnable`. */
|
2505
|
-
fn: Function | undefined;
|
2506
|
-
async: boolean;
|
2507
|
-
sync: boolean;
|
2508
|
-
timedOut: boolean;
|
2509
|
-
/** @deprecated `.timeout()` has additional overloads in `Mocha.Runnable`. */
|
2510
|
-
timeout(n: number | string): this;
|
2511
|
-
duration?: number;
|
2512
|
-
}
|
2513
|
-
|
2514
|
-
/** Partial interface for Mocha's `Suite` class. */
|
2515
|
-
/** @deprecated use `Mocha.Suite` instead. */
|
2516
|
-
interface ISuite {
|
2517
|
-
/** @deprecated `.ctx` has type `Mocha.Context` in `Mocha.Suite`. */
|
2518
|
-
ctx: IContext;
|
2519
|
-
/** @deprecated `.parent` has type `Mocha.Suite | undefined` in `Mocha.Suite`. */
|
2520
|
-
parent: ISuite | undefined;
|
2521
|
-
root: boolean;
|
2522
|
-
title: string;
|
2523
|
-
/** @deprecated `.suites` has type `Mocha.Suite[]` in `Mocha.Suite`. */
|
2524
|
-
suites: ISuite[];
|
2525
|
-
/** @deprecated `.tests` has type `Mocha.Test[]` in `Mocha.Suite`. */
|
2526
|
-
tests: ITest[];
|
2527
|
-
|
2528
|
-
bail(): boolean;
|
2529
|
-
/** @deprecated `.bail()` returns `this` in `Mocha.Suite`. */
|
2530
|
-
bail(bail: boolean): ISuite;
|
2531
|
-
fullTitle(): string;
|
2532
|
-
retries(): number;
|
2533
|
-
/** @deprecated `.retries()` returns `this` in `Mocha.Suite`. */
|
2534
|
-
retries(retries: number): ISuite;
|
2535
|
-
slow(): number;
|
2536
|
-
/** @deprecated `.slow()` returns `this` in `Mocha.Suite`. */
|
2537
|
-
slow(slow: number): ISuite;
|
2538
|
-
timeout(): number;
|
2539
|
-
/** @deprecated `.timeout()` returns `this` in `Mocha.Suite`. */
|
2540
|
-
timeout(timeout: number): ISuite;
|
2541
|
-
}
|
2542
|
-
|
2543
|
-
/** Partial interface for Mocha's `Test` class. */
|
2544
|
-
/** @deprecated use `Mocha.Test` instead. */
|
2545
|
-
interface ITest extends IRunnable {
|
2546
|
-
body?: string;
|
2547
|
-
file?: string;
|
2548
|
-
/** @deprecated `.parent` has type `Mocha.Suite | undefined` in `Mocha.Test`. */
|
2549
|
-
parent?: ISuite;
|
2550
|
-
pending: boolean;
|
2551
|
-
state?: 'failed' | 'passed';
|
2552
|
-
type: 'test';
|
2553
|
-
fullTitle(): string;
|
2554
|
-
}
|
2555
|
-
|
2556
|
-
/** @deprecated use `Mocha.Hook` instead. */
|
2557
|
-
interface IHook extends IRunnable {
|
2558
|
-
/** @deprecated `.ctx` has type `Mocha.Context` in `Mocha.Runnable`. */
|
2559
|
-
ctx?: IContext;
|
2560
|
-
/** @deprecated `.parent` has type `Mocha.Suite` in `Mocha.Runnable`. */
|
2561
|
-
parent?: ISuite;
|
2562
|
-
type: 'hook';
|
2563
|
-
/** @deprecated `.error()` has additional overloads in `Mocha.Hook`. */
|
2564
|
-
error(err: Error): void;
|
2565
|
-
}
|
2566
|
-
|
2567
|
-
/** @deprecated use `Mocha.Context` instead. */
|
2568
|
-
interface IBeforeAndAfterContext extends IHookCallbackContext {
|
2569
|
-
/** @deprecated `.currentTest` has type `Mocha.Test` in `Mocha.Context`. */
|
2570
|
-
currentTest?: ITest;
|
2571
|
-
}
|
2572
|
-
|
2573
|
-
/** @deprecated use `Mocha.Stats` instead. */
|
2574
|
-
type IStats = Stats;
|
2575
|
-
|
2576
|
-
/** Partial interface for Mocha's `Runner` class. */
|
2577
|
-
/** @deprecated use `Mocha.Runner` instead. */
|
2578
|
-
interface IRunner extends NodeJS.EventEmitter {
|
2579
|
-
asyncOnly?: boolean;
|
2580
|
-
stats?: IStats;
|
2581
|
-
started: boolean;
|
2582
|
-
/** @deprecated `.suite` has type `Mocha.Suite` in `Mocha.Runner`. */
|
2583
|
-
suite: ISuite;
|
2584
|
-
total: number;
|
2585
|
-
failures: number;
|
2586
|
-
forbidOnly?: boolean;
|
2587
|
-
forbidPending?: boolean;
|
2588
|
-
fullStackTrace?: boolean;
|
2589
|
-
ignoreLeaks?: boolean;
|
2590
|
-
grep(re: RegExp, invert: boolean): this;
|
2591
|
-
/** @deprecated Parameter `suite` has type `Mocha.Suite` in `Mocha.Runner`. */
|
2592
|
-
grepTotal(suite: ISuite): number;
|
2593
|
-
/** @deprecated `.globals()` has different overloads in `Mocha.Runner`. */
|
2594
|
-
globals(arr: ReadonlyArray<string>): this | string[];
|
2595
|
-
abort(): this;
|
2596
|
-
run(fn?: (failures: number) => void): this;
|
2597
|
-
}
|
2598
|
-
|
2599
|
-
/** @deprecated use `Mocha.SuiteFunction` instead. */
|
2600
|
-
interface IContextDefinition {
|
2601
|
-
/** @deprecated use `Mocha.SuiteFunction` instead. */
|
2602
|
-
(description: string, callback: (this: ISuiteCallbackContext) => void): ISuite;
|
2603
|
-
/** @deprecated use `Mocha.SuiteFunction` instead. */
|
2604
|
-
only(description: string, callback: (this: ISuiteCallbackContext) => void): ISuite;
|
2605
|
-
/** @deprecated use `Mocha.SuiteFunction` instead. */
|
2606
|
-
skip(description: string, callback: (this: ISuiteCallbackContext) => void): void;
|
2607
|
-
}
|
2608
|
-
|
2609
|
-
/** @deprecated use `Mocha.TestFunction` instead. */
|
2610
|
-
interface ITestDefinition {
|
2611
|
-
/** @deprecated use `Mocha.TestFunction` instead. */
|
2612
|
-
/** @deprecated `Mocha.TestFunction` does not allow mixing `done` with a return type of `PromiseLike<any>`. */
|
2613
|
-
(expectation: string, callback?: (this: ITestCallbackContext, done: MochaDone) => PromiseLike<any> | void): ITest;
|
2614
|
-
/** @deprecated use `Mocha.TestFunction` instead. */
|
2615
|
-
/** @deprecated `Mocha.TestFunction#only` does not allow mixing `done` with a return type of `PromiseLike<any>`. */
|
2616
|
-
only(expectation: string, callback?: (this: ITestCallbackContext, done: MochaDone) => PromiseLike<any> | void): ITest;
|
2617
|
-
/** @deprecated use `Mocha.TestFunction` instead. */
|
2618
|
-
/** @deprecated `Mocha.TestFunction#skip` does not allow mixing `done` with a return type of `PromiseLike<any>`. */
|
2619
|
-
skip(expectation: string, callback?: (this: ITestCallbackContext, done: MochaDone) => PromiseLike<any> | void): void;
|
2620
|
-
}
|
2621
|
-
|
2622
|
-
// #endregion
|
2623
2457
|
}
|
2624
2458
|
|
2625
2459
|
// #region Test interface augmentations
|
@@ -2828,30 +2662,11 @@ interface BrowserMocha extends Mocha {
|
|
2828
2662
|
*
|
2829
2663
|
* - _Only supported in the browser._
|
2830
2664
|
*/
|
2831
|
-
setup(opts?: Mocha.Interface |
|
2832
|
-
}
|
2833
|
-
|
2834
|
-
/**
|
2835
|
-
* Options to pass to `mocha.setup` in the browser.
|
2836
|
-
*/
|
2837
|
-
interface MochaSetupOptions extends Mocha.MochaOptions {
|
2838
|
-
/** @deprecated This is not used by Mocha. Use `files` instead. */
|
2839
|
-
require?: string[];
|
2840
|
-
fullTrace?: boolean;
|
2665
|
+
setup(opts?: Mocha.Interface | Mocha.MochaOptions): this;
|
2841
2666
|
}
|
2842
2667
|
|
2843
2668
|
// #endregion Browser augmentations
|
2844
2669
|
|
2845
|
-
// #region Deprecations
|
2846
|
-
|
2847
|
-
/** @deprecated use `Mocha.Done` instead. */
|
2848
|
-
type MochaDone = Mocha.Done;
|
2849
|
-
|
2850
|
-
/** @deprecated use `Mocha.ReporterConstructor` instead. */
|
2851
|
-
type ReporterConstructor = Mocha.ReporterConstructor;
|
2852
|
-
|
2853
|
-
// #endregion Deprecations
|
2854
|
-
|
2855
2670
|
declare module "mocha" {
|
2856
2671
|
export = Mocha;
|
2857
2672
|
}
|