cypress 7.4.0 → 7.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,9 @@ const chalk = require('chalk');
12
12
 
13
13
  const debug = require('debug')('cypress:cli');
14
14
 
15
- const Listr = require('listr');
15
+ const {
16
+ Listr
17
+ } = require('listr2');
16
18
 
17
19
  const verbose = require('@cypress/listr-verbose-renderer');
18
20
 
@@ -179,7 +181,9 @@ const downloadAndUnzip = ({
179
181
  logger.log(`Installing Cypress ${chalk.gray(`(version: ${version})`)}`);
180
182
  logger.log();
181
183
  const tasks = new Listr([{
182
- title: util.titleize('Downloading Cypress'),
184
+ options: {
185
+ title: util.titleize('Downloading Cypress')
186
+ },
183
187
  task: (ctx, task) => {
184
188
  // as our download progresses indicate the status
185
189
  progress.onProgress = progessify(task, 'Downloading Cypress');
@@ -201,7 +205,9 @@ const downloadAndUnzip = ({
201
205
  installDir,
202
206
  rendererOptions
203
207
  }), {
204
- title: util.titleize('Finishing Installation'),
208
+ options: {
209
+ title: util.titleize('Finishing Installation')
210
+ },
205
211
  task: (ctx, task) => {
206
212
  const cleanup = () => {
207
213
  debug('removing zip file %s', downloadDestination);
@@ -213,7 +219,9 @@ const downloadAndUnzip = ({
213
219
  util.setTaskTitle(task, util.titleize(chalk.green('Finished Installation'), chalk.gray(installDir)), rendererOptions.renderer);
214
220
  });
215
221
  }
216
- }], rendererOptions); // start the tasks!
222
+ }], {
223
+ rendererOptions
224
+ }); // start the tasks!
217
225
 
218
226
  return Promise.resolve(tasks.run());
219
227
  };
@@ -361,7 +369,9 @@ const start = (options = {}) => {
361
369
  zipFilePath: absolutePath,
362
370
  installDir,
363
371
  rendererOptions
364
- })], rendererOptions).run();
372
+ })], {
373
+ rendererOptions
374
+ }).run();
365
375
  }
366
376
 
367
377
  if (options.force) {
@@ -396,7 +406,9 @@ const unzipTask = ({
396
406
  rendererOptions
397
407
  }) => {
398
408
  return {
399
- title: util.titleize('Unzipping Cypress'),
409
+ options: {
410
+ title: util.titleize('Unzipping Cypress')
411
+ },
400
412
  task: (ctx, task) => {
401
413
  // as our unzip progresses indicate the status
402
414
  progress.onProgress = progessify(task, 'Unzipping Cypress');
@@ -4,7 +4,9 @@ const _ = require('lodash');
4
4
 
5
5
  const chalk = require('chalk');
6
6
 
7
- const Listr = require('listr');
7
+ const {
8
+ Listr
9
+ } = require('listr2');
8
10
 
9
11
  const debug = require('debug')('cypress:cli');
10
12
 
@@ -184,7 +186,9 @@ function testBinary(version, binaryDir, options) {
184
186
  renderer
185
187
  };
186
188
  const tasks = new Listr([{
187
- title: util.titleize('Verifying Cypress can run', chalk.gray(binaryDir)),
189
+ options: {
190
+ title: util.titleize('Verifying Cypress can run', chalk.gray(binaryDir))
191
+ },
188
192
  task: (ctx, task) => {
189
193
  debug('clearing out the verified version');
190
194
  return state.clearBinaryStateAsync(binaryDir).then(() => {
@@ -197,7 +201,9 @@ function testBinary(version, binaryDir, options) {
197
201
  util.setTaskTitle(task, util.titleize(chalk.green('Verified Cypress!'), chalk.gray(binaryDir)), rendererOptions.renderer);
198
202
  });
199
203
  }
200
- }], rendererOptions);
204
+ }], {
205
+ rendererOptions
206
+ });
201
207
  return tasks.run();
202
208
  }
203
209
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress",
3
- "version": "7.4.0",
3
+ "version": "7.5.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "postinstall": "node index.js --exec install",
@@ -33,7 +33,7 @@
33
33
  "is-ci": "^3.0.0",
34
34
  "is-installed-globally": "~0.4.0",
35
35
  "lazy-ass": "^1.6.0",
36
- "listr": "^0.14.3",
36
+ "listr2": "^3.8.3",
37
37
  "lodash": "^4.17.21",
38
38
  "log-symbols": "^4.0.0",
39
39
  "minimist": "^1.2.5",
@@ -1949,6 +1949,8 @@ declare module "chai" {
1949
1949
  export = chai;
1950
1950
  }
1951
1951
 
1952
- interface Object {
1953
- should: Chai.Assertion;
1954
- }
1952
+ // const a = 1; a.should(1); doesn't work with Cypress
1953
+ // https://github.com/cypress-io/cypress/issues/16548
1954
+ // interface Object {
1955
+ // should: Chai.Assertion;
1956
+ // }
@@ -160,7 +160,7 @@ declare namespace CypressCommandLine {
160
160
  * Specify the type of tests to execute.
161
161
  * @default "e2e"
162
162
  */
163
- testingType: 'e2e' | 'component'
163
+ testingType: Cypress.TestingType
164
164
  }
165
165
 
166
166
  // small utility types to better express meaning of other types
@@ -8,6 +8,7 @@ declare namespace Cypress {
8
8
  type RequestBody = string | object
9
9
  type ViewportOrientation = 'portrait' | 'landscape'
10
10
  type PrevSubject = 'optional' | 'element' | 'document' | 'window'
11
+ type TestingType = 'e2e' | 'component'
11
12
  type PluginConfig = (on: PluginEvents, config: PluginConfigOptions) => void | ConfigOptions | Promise<ConfigOptions>
12
13
 
13
14
  interface CommandOptions {
@@ -251,6 +252,11 @@ declare namespace Cypress {
251
252
  */
252
253
  LocalStorage: LocalStorage
253
254
 
255
+ /**
256
+ * Current testing type, determined by the Test Runner chosen to run.
257
+ */
258
+ testingType: TestingType
259
+
254
260
  /**
255
261
  * Fire automation:request event for internal use.
256
262
  */
@@ -1464,7 +1470,7 @@ declare namespace Cypress {
1464
1470
  * @example
1465
1471
  * cy.request('http://dev.local/seed')
1466
1472
  */
1467
- request(url: string, body?: RequestBody): Chainable<Response>
1473
+ request<T = any>(url: string, body?: RequestBody): Chainable<Response<T>>
1468
1474
  /**
1469
1475
  * Make an HTTP request with specific method.
1470
1476
  *
@@ -1472,7 +1478,7 @@ declare namespace Cypress {
1472
1478
  * @example
1473
1479
  * cy.request('POST', 'http://localhost:8888/users', {name: 'Jane'})
1474
1480
  */
1475
- request(method: HttpMethod, url: string, body?: RequestBody): Chainable<Response>
1481
+ request<T = any>(method: HttpMethod, url: string, body?: RequestBody): Chainable<Response<T>>
1476
1482
  /**
1477
1483
  * Make an HTTP request with specific behavior.
1478
1484
  *
@@ -1483,7 +1489,7 @@ declare namespace Cypress {
1483
1489
  * followRedirect: false // turn off following redirects
1484
1490
  * })
1485
1491
  */
1486
- request(options: Partial<RequestOptions>): Chainable<Response>
1492
+ request<T = any>(options: Partial<RequestOptions>): Chainable<Response<T>>
1487
1493
 
1488
1494
  /**
1489
1495
  * Get the root DOM element.
@@ -2799,7 +2805,7 @@ declare namespace Cypress {
2799
2805
  /**
2800
2806
  * Type of test and associated runner that was launched.
2801
2807
  */
2802
- testingType: 'e2e' | 'component'
2808
+ testingType: TestingType
2803
2809
  /**
2804
2810
  * Cypress version.
2805
2811
  */
@@ -5496,9 +5502,9 @@ declare namespace Cypress {
5496
5502
  consoleProps(): ObjectLike
5497
5503
  }
5498
5504
 
5499
- interface Response {
5505
+ interface Response<T> {
5500
5506
  allRequestResponses: any[]
5501
- body: any
5507
+ body: T
5502
5508
  duration: number
5503
5509
  headers: { [key: string]: string | string[] }
5504
5510
  isOkStatusCode: boolean