cypress 15.0.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/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
- const Promise = require('bluebird');
6
- const tmp = Promise.promisifyAll(require('tmp'));
7
- const fs = require('./fs');
8
- const open = require('./exec/open');
9
- const run = require('./exec/run');
10
- const util = require('./util');
11
- const cli = require('./cli');
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
- * Opens Cypress GUI
15
- * @see https://on.cypress.io/module-api#cypress-open
16
- */
17
- open(options = {}) {
18
- options = util.normalizeModuleOptions(options);
19
- return open.start(options);
20
- },
21
- /**
22
- * Runs Cypress tests in the current project
23
- * @see https://on.cypress.io/module-api#cypress-run
24
- */
25
- run(options = {}) {
26
- if (!run.isValidProject(options.project)) {
27
- return Promise.reject(new Error(`Invalid project path parameter: ${options.project}`));
28
- }
29
- options = util.normalizeModuleOptions(options);
30
- tmp.setGracefulCleanup();
31
- return tmp.fileAsync().then(outputPath => {
32
- options.outputPath = outputPath;
33
- return run.start(options).then(failedTests => {
34
- return fs.readJsonAsync(outputPath, {
35
- throws: false
36
- }).then(output => {
37
- if (!output) {
38
- return {
39
- status: 'failed',
40
- failures: failedTests,
41
- message: 'Could not find Cypress test run results'
42
- };
43
- }
44
- return output;
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
- cli: {
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
- * Parses CLI arguments into an object that you can pass to "cypress.run"
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
- * const cypress = require('cypress')
54
- * const cli = ['cypress', 'run', '--browser', 'firefox']
55
- * const options = await cypress.cli.parseRunArguments(cli)
56
- * // options is {browser: 'firefox'}
57
- * await cypress.run(options)
58
- * @see https://on.cypress.io/module-api
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
- parseRunArguments(args) {
61
- return cli.parseRunCommand(args);
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;