cypress 5.2.0 → 5.3.0

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/cli.js CHANGED
@@ -55,6 +55,10 @@ function unknownOption(flag) {
55
55
 
56
56
  commander.Command.prototype.unknownOption = unknownOption;
57
57
 
58
+ var coerceFalseOrString = function coerceFalseOrString(arg) {
59
+ return arg !== 'false' ? arg : false;
60
+ };
61
+
58
62
  var coerceFalse = function coerceFalse(arg) {
59
63
  return arg !== 'false';
60
64
  };
@@ -196,7 +200,7 @@ var castCypressRunOptions = function castCypressRunOptions(opts) {
196
200
  // boolean arguments
197
201
  var result = R.evolve({
198
202
  port: coerceAnyStringToInt,
199
- configFile: coerceFalse
203
+ configFile: coerceFalseOrString
200
204
  })(opts);
201
205
  return result;
202
206
  };
package/lib/util.js CHANGED
@@ -449,20 +449,19 @@ var util = {
449
449
  },
450
450
  getEnv: function getEnv(varName, trim) {
451
451
  la(is.unemptyString(varName), 'expected environment variable name, not', varName);
452
- var envVar = process.env[varName];
453
- var configVar = process.env["npm_config_".concat(varName)];
454
- var packageConfigVar = process.env["npm_package_config_".concat(varName)];
452
+ var configVarName = "npm_config_".concat(varName);
453
+ var packageConfigVarName = "npm_package_config_".concat(varName);
455
454
  var result;
456
455
 
457
- if (envVar) {
456
+ if (process.env.hasOwnProperty(varName)) {
458
457
  debug("Using ".concat(varName, " from environment variable"));
459
- result = envVar;
460
- } else if (configVar) {
458
+ result = process.env[varName];
459
+ } else if (process.env.hasOwnProperty(configVarName)) {
461
460
  debug("Using ".concat(varName, " from npm config"));
462
- result = configVar;
463
- } else if (packageConfigVar) {
461
+ result = process.env[configVarName];
462
+ } else if (process.env.hasOwnProperty(packageConfigVarName)) {
464
463
  debug("Using ".concat(varName, " from package.json config"));
465
- result = packageConfigVar;
464
+ result = process.env[packageConfigVarName];
466
465
  } // environment variables are often set double quotes to escape characters
467
466
  // and on Windows it can lead to weird things: for example
468
467
  // set FOO="C:\foo.txt" && node -e "console.log('>>>%s<<<', process.env.FOO)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "postinstall": "node index.js --exec install",
@@ -264,6 +264,7 @@ declare namespace CypressCommandLine {
264
264
  * @see https://on.cypress.io/module-api
265
265
  */
266
266
  interface CypressRunResult {
267
+ status: 'finished'
267
268
  startedTestsAt: dateTimeISO
268
269
  endedTestsAt: dateTimeISO
269
270
  totalDuration: ms
@@ -294,7 +295,8 @@ declare namespace CypressCommandLine {
294
295
  * @example
295
296
  ```
296
297
  const result = await cypress.run()
297
- if (result.failures) {
298
+ if (result.status === 'failed') {
299
+ console.error('failures %d', result.failures)
298
300
  console.error(result.message)
299
301
  process.exit(result.failures)
300
302
  }
@@ -302,6 +304,7 @@ declare namespace CypressCommandLine {
302
304
  *
303
305
  **/
304
306
  interface CypressFailedRunResult {
307
+ status: 'failed'
305
308
  failures: number
306
309
  message: string
307
310
  }
@@ -347,7 +350,11 @@ declare module 'cypress' {
347
350
  cypress.run({
348
351
  spec: 'cypress/integration/admin*-spec.js'
349
352
  }).then(results => {
350
- // inspect results object
353
+ if (results.status === 'failed') {
354
+ // Cypress could not run
355
+ } else {
356
+ // inspect results object
357
+ }
351
358
  })
352
359
  ```
353
360
  */
@@ -2564,7 +2564,7 @@ declare namespace Cypress {
2564
2564
  */
2565
2565
  waitForAnimations: boolean
2566
2566
  /**
2567
- * Firefox-only: The number of tests that will run between forced garbage collections.
2567
+ * Firefox version 79 and below only: The number of tests that will run between forced garbage collections.
2568
2568
  * If a number is supplied, it will apply to `run` mode and `open` mode.
2569
2569
  * Set the interval to `null` or 0 to disable forced garbage collections.
2570
2570
  * @default { runMode: 1, openMode: null }
@@ -5042,7 +5042,7 @@ declare namespace Cypress {
5042
5042
  })
5043
5043
  ```
5044
5044
  */
5045
- (action: 'uncaught:exception', fn: (error: Error, runnable: Mocha.IRunnable) => false | void): void
5045
+ (action: 'uncaught:exception', fn: (error: Error, runnable: Mocha.Runnable) => false | void): void
5046
5046
  /**
5047
5047
  * Fires when your app calls the global `window.confirm()` method.
5048
5048
  * Cypress will auto accept confirmations. Return `false` from this event and the confirmation will be canceled.
@@ -5102,7 +5102,7 @@ declare namespace Cypress {
5102
5102
  * Fires when the test has failed. It is technically possible to prevent the test from actually failing by binding to this event and invoking an async `done` callback. However this is **strongly discouraged**. Tests should never legitimately fail. This event exists because it's extremely useful for debugging purposes.
5103
5103
  * @see https://on.cypress.io/catalog-of-events#App-Events
5104
5104
  */
5105
- (action: 'fail', fn: (error: Error, mocha: Mocha.IRunnable) => void): void
5105
+ (action: 'fail', fn: (error: Error, mocha: Mocha.Runnable) => void): void
5106
5106
  /**
5107
5107
  * Fires whenever the viewport changes via a `cy.viewport()` or naturally when Cypress resets the viewport to the default between tests. Useful for debugging purposes.
5108
5108
  * @see https://on.cypress.io/catalog-of-events#App-Events
@@ -5147,16 +5147,16 @@ declare namespace Cypress {
5147
5147
  * Fires before the test and all **before** and **beforeEach** hooks run.
5148
5148
  * @see https://on.cypress.io/catalog-of-events#App-Events
5149
5149
  */
5150
- (action: 'test:before:run', fn: (attributes: ObjectLike, test: Mocha.ITest) => void): void
5150
+ (action: 'test:before:run', fn: (attributes: ObjectLike, test: Mocha.Test) => void): void
5151
5151
  /**
5152
5152
  * Fires before the test and all **before** and **beforeEach** hooks run. If a `Promise` is returned, it will be awaited before proceeding.
5153
5153
  */
5154
- (action: 'test:before:run:async', fn: (attributes: ObjectLike, test: Mocha.ITest) => void | Promise<any>): void
5154
+ (action: 'test:before:run:async', fn: (attributes: ObjectLike, test: Mocha.Test) => void | Promise<any>): void
5155
5155
  /**
5156
5156
  * Fires after the test and all **afterEach** and **after** hooks run.
5157
5157
  * @see https://on.cypress.io/catalog-of-events#App-Events
5158
5158
  */
5159
- (action: 'test:after:run', fn: (attributes: ObjectLike, test: Mocha.ITest) => void): void
5159
+ (action: 'test:after:run', fn: (attributes: ObjectLike, test: Mocha.Test) => void): void
5160
5160
  }
5161
5161
 
5162
5162
  // $CommandQueue from `command_queue.coffee` - a lot to type. Might be more useful if it was written in TS