cypress 5.2.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/cli.js +5 -1
- package/lib/util.js +8 -9
- package/package.json +1 -1
- package/types/cypress-npm-api.d.ts +9 -2
- package/types/cypress.d.ts +6 -6
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:
|
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
|
453
|
-
var
|
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 (
|
456
|
+
if (process.env.hasOwnProperty(varName)) {
|
458
457
|
debug("Using ".concat(varName, " from environment variable"));
|
459
|
-
result =
|
460
|
-
} else if (
|
458
|
+
result = process.env[varName];
|
459
|
+
} else if (process.env.hasOwnProperty(configVarName)) {
|
461
460
|
debug("Using ".concat(varName, " from npm config"));
|
462
|
-
result =
|
463
|
-
} else if (
|
461
|
+
result = process.env[configVarName];
|
462
|
+
} else if (process.env.hasOwnProperty(packageConfigVarName)) {
|
464
463
|
debug("Using ".concat(varName, " from package.json config"));
|
465
|
-
result =
|
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
@@ -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.
|
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
|
-
|
353
|
+
if (results.status === 'failed') {
|
354
|
+
// Cypress could not run
|
355
|
+
} else {
|
356
|
+
// inspect results object
|
357
|
+
}
|
351
358
|
})
|
352
359
|
```
|
353
360
|
*/
|
package/types/cypress.d.ts
CHANGED
@@ -2564,7 +2564,7 @@ declare namespace Cypress {
|
|
2564
2564
|
*/
|
2565
2565
|
waitForAnimations: boolean
|
2566
2566
|
/**
|
2567
|
-
* Firefox
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|