cypress 15.1.0 → 15.2.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/bin/cypress +3 -1
- package/index.js +49 -24
- package/lib/VerboseRenderer.js +50 -47
- package/lib/cli.js +455 -351
- package/lib/cypress.js +93 -90
- package/lib/errors.js +181 -194
- package/lib/exec/info.js +85 -74
- package/lib/exec/open.js +77 -73
- package/lib/exec/run.js +144 -154
- package/lib/exec/shared.js +37 -44
- package/lib/exec/spawn.js +270 -232
- package/lib/exec/versions.js +57 -49
- package/lib/exec/xvfb.js +79 -81
- package/lib/fs.js +7 -3
- package/lib/logger.js +37 -32
- package/lib/tasks/cache.js +128 -113
- package/lib/tasks/download.js +247 -258
- package/lib/tasks/get-folder-size.js +33 -22
- package/lib/tasks/install.js +274 -312
- package/lib/tasks/state.js +132 -143
- package/lib/tasks/unzip.js +186 -188
- package/lib/tasks/verify.js +274 -261
- package/lib/util.js +357 -355
- package/package.json +3 -3
package/lib/cypress.js
CHANGED
@@ -1,98 +1,101 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
// https://github.com/cypress-io/cypress/issues/316
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
5
|
+
};
|
6
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
7
|
+
const tmp_1 = __importDefault(require("tmp"));
|
8
|
+
const fs_1 = __importDefault(require("./fs"));
|
9
|
+
const open_1 = __importDefault(require("./exec/open"));
|
10
|
+
const run_1 = __importDefault(require("./exec/run"));
|
11
|
+
const util_1 = __importDefault(require("./util"));
|
12
|
+
const cli_1 = __importDefault(require("./cli"));
|
13
|
+
const tmp = bluebird_1.default.promisifyAll(tmp_1.default);
|
12
14
|
const cypressModuleApi = {
|
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
|
-
|
15
|
+
/**
|
16
|
+
* Opens Cypress GUI
|
17
|
+
* @see https://on.cypress.io/module-api#cypress-open
|
18
|
+
*/
|
19
|
+
open(options = {}) {
|
20
|
+
options = util_1.default.normalizeModuleOptions(options);
|
21
|
+
return open_1.default.start(options);
|
22
|
+
},
|
23
|
+
/**
|
24
|
+
* Runs Cypress tests in the current project
|
25
|
+
* @see https://on.cypress.io/module-api#cypress-run
|
26
|
+
*/
|
27
|
+
run(options = {}) {
|
28
|
+
if (!run_1.default.isValidProject(options.project)) {
|
29
|
+
return bluebird_1.default.reject(new Error(`Invalid project path parameter: ${options.project}`));
|
30
|
+
}
|
31
|
+
options = util_1.default.normalizeModuleOptions(options);
|
32
|
+
tmp.setGracefulCleanup();
|
33
|
+
return tmp.fileAsync()
|
34
|
+
.then((outputPath) => {
|
35
|
+
options.outputPath = outputPath;
|
36
|
+
return run_1.default.start(options)
|
37
|
+
.then((failedTests) => {
|
38
|
+
return fs_1.default.readJsonAsync(outputPath, { throws: false })
|
39
|
+
.then((output) => {
|
40
|
+
if (!output) {
|
41
|
+
return {
|
42
|
+
status: 'failed',
|
43
|
+
failures: failedTests,
|
44
|
+
message: 'Could not find Cypress test run results',
|
45
|
+
};
|
46
|
+
}
|
47
|
+
return output;
|
48
|
+
});
|
49
|
+
});
|
45
50
|
});
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
51
|
+
},
|
52
|
+
cli: {
|
53
|
+
/**
|
54
|
+
* Parses CLI arguments into an object that you can pass to "cypress.run"
|
55
|
+
* @example
|
56
|
+
* const cypress = require('cypress')
|
57
|
+
* const cli = ['cypress', 'run', '--browser', 'firefox']
|
58
|
+
* const options = await cypress.cli.parseRunArguments(cli)
|
59
|
+
* // options is {browser: 'firefox'}
|
60
|
+
* await cypress.run(options)
|
61
|
+
* @see https://on.cypress.io/module-api
|
62
|
+
*/
|
63
|
+
parseRunArguments(args) {
|
64
|
+
return cli_1.default.parseRunCommand(args);
|
65
|
+
},
|
66
|
+
},
|
67
|
+
/**
|
68
|
+
* Provides automatic code completion for configuration in many popular code editors.
|
69
|
+
* While it's not strictly necessary for Cypress to parse your configuration, we
|
70
|
+
* recommend wrapping your config object with `defineConfig()`
|
71
|
+
* @example
|
72
|
+
* module.exports = defineConfig({
|
73
|
+
* viewportWith: 400
|
74
|
+
* })
|
75
|
+
*
|
76
|
+
* @see ../types/cypress-npm-api.d.ts
|
77
|
+
* @param {Cypress.ConfigOptions} config
|
78
|
+
* @returns {Cypress.ConfigOptions} the configuration passed in parameter
|
79
|
+
*/
|
80
|
+
defineConfig(config) {
|
81
|
+
return config;
|
82
|
+
},
|
50
83
|
/**
|
51
|
-
*
|
84
|
+
* Provides automatic code completion for Component Frameworks Definitions.
|
85
|
+
* While it's not strictly necessary for Cypress to parse your configuration, we
|
86
|
+
* recommend wrapping your Component Framework Definition object with `defineComponentFramework()`
|
52
87
|
* @example
|
53
|
-
*
|
54
|
-
*
|
55
|
-
*
|
56
|
-
*
|
57
|
-
*
|
58
|
-
* @see
|
88
|
+
* module.exports = defineComponentFramework({
|
89
|
+
* type: 'cypress-ct-solid-js'
|
90
|
+
* // ...
|
91
|
+
* })
|
92
|
+
*
|
93
|
+
* @see ../types/cypress-npm-api.d.ts
|
94
|
+
* @param {Cypress.ThirdPartyComponentFrameworkDefinition} config
|
95
|
+
* @returns {Cypress.ThirdPartyComponentFrameworkDefinition} the configuration passed in parameter
|
59
96
|
*/
|
60
|
-
|
61
|
-
|
62
|
-
}
|
63
|
-
},
|
64
|
-
/**
|
65
|
-
* Provides automatic code completion for configuration in many popular code editors.
|
66
|
-
* While it's not strictly necessary for Cypress to parse your configuration, we
|
67
|
-
* recommend wrapping your config object with `defineConfig()`
|
68
|
-
* @example
|
69
|
-
* module.exports = defineConfig({
|
70
|
-
* viewportWith: 400
|
71
|
-
* })
|
72
|
-
*
|
73
|
-
* @see ../types/cypress-npm-api.d.ts
|
74
|
-
* @param {Cypress.ConfigOptions} config
|
75
|
-
* @returns {Cypress.ConfigOptions} the configuration passed in parameter
|
76
|
-
*/
|
77
|
-
defineConfig(config) {
|
78
|
-
return config;
|
79
|
-
},
|
80
|
-
/**
|
81
|
-
* Provides automatic code completion for Component Frameworks Definitions.
|
82
|
-
* While it's not strictly necessary for Cypress to parse your configuration, we
|
83
|
-
* recommend wrapping your Component Framework Definition object with `defineComponentFramework()`
|
84
|
-
* @example
|
85
|
-
* module.exports = defineComponentFramework({
|
86
|
-
* type: 'cypress-ct-solid-js'
|
87
|
-
* // ...
|
88
|
-
* })
|
89
|
-
*
|
90
|
-
* @see ../types/cypress-npm-api.d.ts
|
91
|
-
* @param {Cypress.ThirdPartyComponentFrameworkDefinition} config
|
92
|
-
* @returns {Cypress.ThirdPartyComponentFrameworkDefinition} the configuration passed in parameter
|
93
|
-
*/
|
94
|
-
defineComponentFramework(config) {
|
95
|
-
return config;
|
96
|
-
}
|
97
|
+
defineComponentFramework(config) {
|
98
|
+
return config;
|
99
|
+
},
|
97
100
|
};
|
98
|
-
module.exports = cypressModuleApi;
|
101
|
+
module.exports = cypressModuleApi;
|