browserstack-cypress-cli 1.15.0 → 1.18.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/commands/runs.js +8 -3
- package/bin/helpers/archiver.js +8 -5
- package/bin/helpers/buildArtifacts.js +3 -3
- package/bin/helpers/capabilityHelper.js +47 -15
- package/bin/helpers/checkUploaded.js +8 -5
- package/bin/helpers/constants.js +268 -112
- package/bin/helpers/packageInstaller.js +19 -3
- package/bin/helpers/reporterHTML.js +55 -262
- package/bin/helpers/usageReporting.js +3 -3
- package/bin/helpers/utils.js +98 -20
- package/bin/runner.js +6 -1
- package/package.json +2 -2
- package/log/usage.log +0 -2
package/bin/helpers/constants.js
CHANGED
|
@@ -1,72 +1,115 @@
|
|
|
1
1
|
let config = require("./config");
|
|
2
|
-
let chalk = require(
|
|
2
|
+
let chalk = require("chalk");
|
|
3
3
|
|
|
4
4
|
const syncCLI = {
|
|
5
|
-
FAILED_SPEC_DETAILS_COL_HEADER: [
|
|
5
|
+
FAILED_SPEC_DETAILS_COL_HEADER: [
|
|
6
|
+
"Spec",
|
|
7
|
+
"Status",
|
|
8
|
+
"Browser",
|
|
9
|
+
"BrowserStack Session ID",
|
|
10
|
+
],
|
|
6
11
|
LOGS: {
|
|
7
|
-
INIT_LOG: "All tests:"
|
|
12
|
+
INIT_LOG: "All tests:",
|
|
8
13
|
},
|
|
9
14
|
INITIAL_DELAY_MULTIPLIER: 10,
|
|
10
|
-
DEFAULT_LINE_SEP:
|
|
11
|
-
|
|
15
|
+
DEFAULT_LINE_SEP:
|
|
16
|
+
"\n--------------------------------------------------------------------------------",
|
|
17
|
+
STARTUP_MESSAGE:
|
|
18
|
+
"BrowserStack machines are now setting up Cypress with the specified npm dependencies for running your tests. It might take some time before your tests start runnning and showing up below...",
|
|
12
19
|
};
|
|
13
20
|
|
|
14
21
|
const userMessages = {
|
|
15
22
|
BUILD_FAILED: "Build creation failed.",
|
|
16
|
-
BUILD_GENERATE_REPORT_FAILED:
|
|
23
|
+
BUILD_GENERATE_REPORT_FAILED:
|
|
24
|
+
"Generating report for the build <build-id> failed.",
|
|
17
25
|
BUILD_CREATED: "Build created",
|
|
18
26
|
BUILD_INFO_FAILED: "Failed to get build info.",
|
|
19
27
|
BUILD_STOP_FAILED: "Failed to stop build.",
|
|
20
28
|
BUILD_REPORT_MESSAGE: "See the entire build report here:",
|
|
21
|
-
ZIP_UPLOADER_NOT_REACHABLE:
|
|
29
|
+
ZIP_UPLOADER_NOT_REACHABLE:
|
|
30
|
+
"Could not reach BrowserStack APIs. Please check your network or see if you need to whitelist *.browserstack.com",
|
|
22
31
|
ZIP_UPLOAD_FAILED: "Zip Upload failed.",
|
|
23
|
-
ZIP_UPLOAD_LIMIT_EXCEEDED:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
ZIP_UPLOAD_LIMIT_EXCEEDED:
|
|
33
|
+
"The directory size which contains the cypress config file is more than 200 MB. For more info, check out https://www.browserstack.com/docs/automate/cypress/exclude-files",
|
|
34
|
+
NODE_MODULES_LIMIT_EXCEEDED:
|
|
35
|
+
"node_modules upload failed as the size %SIZE% MB is not supported. Dependencies will be installed in runtime. This will have a negative impact on build performance. Reach out to us at browserstack.com/support if you see this warning.",
|
|
36
|
+
CONFIG_FILE_CREATED:
|
|
37
|
+
"BrowserStack Config File created, you can now run browserstack-cypress --config-file run",
|
|
38
|
+
CONFIG_FILE_EXISTS:
|
|
39
|
+
"File already exists, delete the browserstack.json file manually. skipping...",
|
|
40
|
+
DIR_NOT_FOUND:
|
|
41
|
+
"Given path does not exist. Failed to create browserstack.json in %s",
|
|
42
|
+
MD5_CHECK_FAILED:
|
|
43
|
+
"There was some issue while checking if zip is already uploaded.",
|
|
29
44
|
ZIP_DELETE_FAILED: "Could not delete tests.zip successfully.",
|
|
30
45
|
ZIP_DELETED: "Deleted tests.zip successfully.",
|
|
31
|
-
NPM_INSTALL_AND_UPLOAD:
|
|
46
|
+
NPM_INSTALL_AND_UPLOAD:
|
|
47
|
+
"Installing required dependencies and building the package to upload to BrowserStack",
|
|
32
48
|
NPM_DELETE_FAILED: "Could not delete the dependency packages.",
|
|
33
49
|
NPM_DELETED: "Deleted dependency packages successfully.",
|
|
34
|
-
API_DEPRECATED:
|
|
50
|
+
API_DEPRECATED:
|
|
51
|
+
"This version of API is deprecated, please use latest version of API.",
|
|
35
52
|
FAILED_TO_ZIP: "Failed to zip files.",
|
|
36
|
-
FAILED_CREATE_NPM_ARCHIVE:
|
|
37
|
-
|
|
53
|
+
FAILED_CREATE_NPM_ARCHIVE:
|
|
54
|
+
"CLI execution failed due to some issue in npm setup. Please retry.",
|
|
55
|
+
FAILED_MD5_CHECK:
|
|
56
|
+
"Something went wrong - you can retry running browserstack-cypress with ‘--force-upload’ parameter, or contact BrowserStack Support.",
|
|
38
57
|
VISIT_DASHBOARD: "Visit the Automate dashboard for real-time test reporting:",
|
|
39
|
-
CONFLICTING_INIT_ARGUMENTS:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
CONFLICTING_INIT_ARGUMENTS:
|
|
59
|
+
"Conflicting arguments given. You can use --path only with a file name, and not with a file path.",
|
|
60
|
+
NO_PARALLELS:
|
|
61
|
+
"Your specs will run sequentially on a single machine. Read more about running your specs in parallel here: https://www.browserstack.com/docs/automate/cypress/run-tests-in-parallel",
|
|
62
|
+
NO_NPM_DEPENDENCIES:
|
|
63
|
+
"No npm dependencies specified - your specs might fail if they need any packages to be installed before running.",
|
|
64
|
+
NO_NPM_DEPENDENCIES_READ_MORE:
|
|
65
|
+
"Read more about npm dependencies here: https://www.browserstack.com/docs/automate/cypress/npm-packages. You can suppress this warning by using --disable-npm-warning flag.",
|
|
43
66
|
VALIDATING_CONFIG: "Validating the config",
|
|
44
67
|
UPLOADING_TESTS: "Uploading the tests to BrowserStack",
|
|
45
68
|
UPLOADING_TESTS_SUCCESS: "Uploaded tests successfully",
|
|
46
69
|
UPLOADING_NPM_PACKAGES: "Uploading required node_modules to BrowserStack",
|
|
47
70
|
UPLOADING_NPM_PACKAGES_SUCCESS: "Uploaded node_modules successfully",
|
|
48
|
-
SKIP_UPLOADING_TESTS:
|
|
49
|
-
|
|
71
|
+
SKIP_UPLOADING_TESTS:
|
|
72
|
+
"Skipping zip upload since BrowserStack already has your test suite that has not changed since the last run.",
|
|
73
|
+
SKIP_UPLOADING_NPM_PACKAGES:
|
|
74
|
+
"Skipping the upload of node_modules since BrowserStack has already cached your npm dependencies that have not changed since the last run.",
|
|
50
75
|
LOCAL_TRUE: "you will now be able to test localhost / private URLs",
|
|
51
76
|
LOCAL_FALSE: "you won't be able to test localhost / private URLs",
|
|
52
|
-
EXIT_SYNC_CLI_MESSAGE:
|
|
77
|
+
EXIT_SYNC_CLI_MESSAGE:
|
|
78
|
+
"Exiting the CLI, but your build is still running. You can use the --sync option to keep getting test updates. You can also use the build-info <build-id> command now.",
|
|
53
79
|
FATAL_NETWORK_ERROR: `fatal: unable to access '${config.buildUrl}': Could not resolve host: ${config.rails_host}`,
|
|
54
80
|
RETRY_LIMIT_EXCEEDED: `Max retries exceeded trying to connect to the host (retries: ${config.retries})`,
|
|
55
81
|
CHECK_DASHBOARD_AT: "Please check the build status at: ",
|
|
56
|
-
CYPRESS_VERSION_CHANGED:
|
|
82
|
+
CYPRESS_VERSION_CHANGED:
|
|
83
|
+
"Your build will run using Cypress <actualVersion> instead of Cypress <preferredVersion>.<frameworkUpgradeMessage> Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions",
|
|
57
84
|
LOCAL_START_FAILED: "Local Testing setup failed.",
|
|
58
85
|
LOCAL_STOP_FAILED: "Local Binary stop failed.",
|
|
59
|
-
INVALID_LOCAL_MODE_WARNING:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
86
|
+
INVALID_LOCAL_MODE_WARNING:
|
|
87
|
+
'Invalid value specified for local_mode. local_mode: ("always-on" | "on-demand"). For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference',
|
|
88
|
+
LOCAL_BINARY_ALREADY_RUNNING:
|
|
89
|
+
"We found an existing BrowserStack Local connection running from your account. Using the existing connection for this build. If you wish to use a new Local connection for your build, please specify a value for 'local_identifier' within 'connection_settings' in your browserstack.json config.",
|
|
90
|
+
SPEC_LIMIT_WARNING:
|
|
91
|
+
"You might not see all your results on the dashboard because of high spec count, please consider reducing the number of spec files in this folder.",
|
|
92
|
+
DOWNLOAD_BUILD_ARTIFACTS_FAILED:
|
|
93
|
+
"Downloading build artifacts for the build <build-id> failed for <machine-count> machines.",
|
|
94
|
+
ASYNC_DOWNLOADS:
|
|
95
|
+
"Test artifacts as specified under 'downloads' can be downloaded after the build has completed its run, using 'browserstack-cypress generate-downloads <build-id>'",
|
|
96
|
+
DOWNLOAD_BUILD_ARTIFACTS_SUCCESS:
|
|
97
|
+
"Your build artifact(s) have been successfully downloaded in '<user-path>/build_artifacts/<build-id>' directory",
|
|
98
|
+
LATEST_SYNTAX_TO_ACTUAL_VERSION_MESSAGE:
|
|
99
|
+
"Your build will run using Cypress <actualVersion> as you had specified <latestSyntaxVersion>.<frameworkUpgradeMessage> Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions",
|
|
100
|
+
PROCESS_KILL_MESSAGE:
|
|
101
|
+
"Stopping the CLI and the execution of the build on BrowserStack",
|
|
102
|
+
BUILD_FAILED_ERROR:
|
|
103
|
+
"The above stacktrace has been thrown by Cypress when we tried to run your build. If your test suite requires npm dependencies then please specify them on browserstack.json. Read more at " +
|
|
104
|
+
chalk.blueBright(
|
|
105
|
+
"https://www.browserstack.com/docs/automate/cypress/npm-packages"
|
|
106
|
+
) +
|
|
107
|
+
". Also, we recommend you to try running the build locally using ‘cypress run’ and if it works fine then please reach out to support at " +
|
|
108
|
+
chalk.blueBright("https://www.browserstack.com/contact#technical-support"),
|
|
109
|
+
SPEC_TIMEOUT_LIMIT_WARNING:
|
|
110
|
+
"Value for the 'spec_timeout' key not in the 1-120 range. Going ahead with 30 mins as the default spec timeout. Read more about how to specify the option in https://browserstack.com/docs/automate/cypress/spec-timeout",
|
|
111
|
+
SPEC_LIMIT_SUCCESS_MESSAGE:
|
|
112
|
+
"Spec timeout specified as <x> minutes. If any of your specs exceed the specified time limit, it would be forcibly killed by BrowserStack",
|
|
70
113
|
};
|
|
71
114
|
|
|
72
115
|
const validationMessages = {
|
|
@@ -75,37 +118,66 @@ const validationMessages = {
|
|
|
75
118
|
EMPTY_TEST_SUITE: "Test suite is empty",
|
|
76
119
|
EMPTY_BROWSERSTACK_JSON: "Empty browserstack.json",
|
|
77
120
|
EMPTY_RUN_SETTINGS: "Empty run settings",
|
|
78
|
-
EMPTY_CYPRESS_PROJ_DIR:
|
|
121
|
+
EMPTY_CYPRESS_PROJ_DIR:
|
|
122
|
+
"cypress_proj_dir is not set in run_settings. See https://www.browserstack.com/docs/automate/cypress/sample-tutorial to learn more.",
|
|
123
|
+
EMPTY_CYPRESS_CONFIG_FILE:
|
|
124
|
+
"cypress_config_file is not set in run_settings. See https://www.browserstack.com/docs/automate/cypress/configuration-file to learn more.",
|
|
79
125
|
VALIDATED: "browserstack.json file is validated",
|
|
80
126
|
NOT_VALID: "browerstack.json is not valid",
|
|
81
127
|
NOT_VALID_JSON: "browerstack.json is not a valid json",
|
|
82
128
|
INVALID_EXTENSION: "Invalid files, please remove these files and try again.",
|
|
83
|
-
INVALID_PARALLELS_CONFIGURATION:
|
|
129
|
+
INVALID_PARALLELS_CONFIGURATION:
|
|
130
|
+
"Invalid value specified for parallels to use. Maximum parallels to use should be a number greater than 0.",
|
|
84
131
|
INVALID_CYPRESS_CONFIG_FILE: "Invalid cypress_config_file",
|
|
85
|
-
|
|
132
|
+
CYPRESS_CONFIG_FILE_NOT_FOUND:
|
|
133
|
+
"No cypress config file was found at <location> directory.",
|
|
134
|
+
MORE_THAN_ONE_CYPRESS_CONFIG_FILE_FOUND:
|
|
135
|
+
"Cypress does not allow more than one cypress config file.",
|
|
86
136
|
INVALID_CYPRESS_JSON: "cypress.json is not a valid json",
|
|
87
|
-
INVALID_DEFAULT_AUTH_PARAMS:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
137
|
+
INVALID_DEFAULT_AUTH_PARAMS:
|
|
138
|
+
"Your username and access key are required to run your tests on BrowserStack. Learn more at https://www.browserstack.com/docs/automate/cypress/authentication",
|
|
139
|
+
LOCAL_NOT_SET:
|
|
140
|
+
"To test <baseUrlValue> on BrowserStack, you will have to set up Local testing. Read more here: https://www.browserstack.com/docs/automate/cypress/local-testing",
|
|
141
|
+
INCORRECT_DIRECTORY_STRUCTURE:
|
|
142
|
+
"No tests to run. Note that your Cypress tests should be in the same directory where the cypress.json exists.",
|
|
143
|
+
INVALID_CLI_LOCAL_IDENTIFIER:
|
|
144
|
+
"When using --local-identifier, a value needs to be supplied. \n--local-identifier <String>.\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
|
|
145
|
+
INVALID_LOCAL_MODE:
|
|
146
|
+
'When using --local-mode, a value needs to be supplied. \n--local-mode ("always-on" | "on-demand").\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference',
|
|
147
|
+
INVALID_LOCAL_CONFIG_FILE:
|
|
148
|
+
"Using --local-config-file requires an input of the form /path/to/config-file.yml.\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
|
|
149
|
+
INVALID_LOCAL_IDENTIFIER:
|
|
150
|
+
"Invalid value specified for local_identifier. For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
|
|
151
|
+
INVALID_BROWSER_ARGS:
|
|
152
|
+
"Aborting as an unacceptable value was passed for --browser. Read more at https://www.browserstack.com/docs/automate/cypress/cli-reference",
|
|
153
|
+
INVALID_LOCAL_ASYNC_ARGS:
|
|
154
|
+
"Cannot run in --async mode when local is set to true. Please run the build after removing --async",
|
|
155
|
+
INVALID_GEO_LOCATION:
|
|
156
|
+
"[BROWSERSTACK_INVALID_COUNTRY_CODE] The country code specified for 'geolocation' is invalid. For list of supported countries, refer to - https://www.browserstack.com/ip-geolocation",
|
|
157
|
+
NOT_SUPPORTED_GEO_LOCATION:
|
|
158
|
+
"The country code you have passed for IP Geolocation is currently not supported. Please refer the link https://www.browserstack.com/ip-geolocation for a list of supported countries.",
|
|
159
|
+
NOT_AVAILABLE_GEO_LOCATION:
|
|
160
|
+
"The country code you have passed for IP Geolocation is not available at the moment. Please try again in a few hours.",
|
|
161
|
+
ACCESS_DENIED_GEO_LOCATION:
|
|
162
|
+
"'geolocation' (IP Geolocation feature) capability is not supported in your account. It is only available under Enterprise plans, refer https://www.browserstack.com/ip-geolocation for more details.",
|
|
163
|
+
NOT_ALLOWED_GEO_LOCATION_AND_LOCAL_MODE:
|
|
164
|
+
"IP Geolocation feature is not available in conjunction with BrowserStack Local.",
|
|
165
|
+
HOME_DIRECTORY_NOT_FOUND:
|
|
166
|
+
"Specified home directory could not be found. Please make sure the path of the home directory is correct.",
|
|
167
|
+
HOME_DIRECTORY_NOT_A_DIRECTORY:
|
|
168
|
+
"Specified home directory is not a directory. The home directory can only be a directory and not a file.",
|
|
169
|
+
CYPRESS_CONFIG_FILE_NOT_PART_OF_HOME_DIRECTORY:
|
|
170
|
+
"Could not find cypress.json within the specified home directory. Please make sure cypress.json resides within the home directory.",
|
|
171
|
+
SPEC_TIMEOUT_LIMIT_ERROR:
|
|
172
|
+
"The maximum allowed value of 'spec_timeout' is 120. Read more on https://browserstack.com/docs/automate/cypress/spec-timeout ",
|
|
173
|
+
SPEC_TIMEOUT_NOT_PASSED_ERROR:
|
|
174
|
+
"'spec_timeout' key not specified. Going ahead with 30 mins as the default spec timeout. Read more about how to specify the option in https://browserstack.com/docs/automate/cypress/spec-timeout ",
|
|
175
|
+
PROJECT_ID_MISSING:
|
|
176
|
+
"You have specified '--record' flag but you've not provided the 'projectId' in cypress.json or in browserstack.json. Your record functionality on cypress.io dashboard might not work as it needs both the key and the projectId",
|
|
177
|
+
RECORD_KEY_MISSING:
|
|
178
|
+
"You have specified '--record' flag but you've not provided the '--record-key' and we could not find any value in 'CYPRESS_RECORD_KEY' environment variable. Your record functionality on cypress.io dashboard might not work as it needs the key and projectId",
|
|
179
|
+
NODE_VERSION_PARSING_ERROR:
|
|
180
|
+
"We weren't able to successfully parse the specified nodeVersion. We will be using the default nodeVersion to run your tests.",
|
|
109
181
|
};
|
|
110
182
|
|
|
111
183
|
const cliMessages = {
|
|
@@ -126,26 +198,34 @@ const cliMessages = {
|
|
|
126
198
|
STOP_MESSAGE: "Stopping build with given buildId ",
|
|
127
199
|
},
|
|
128
200
|
RUN: {
|
|
129
|
-
PARALLEL_DESC:
|
|
201
|
+
PARALLEL_DESC:
|
|
202
|
+
"The maximum number of parallels to use to run your test suite",
|
|
130
203
|
INFO: "Run your tests on BrowserStack. For more help: `browserstack-cypress run --help`.",
|
|
131
204
|
CYPRESS_DESC: "Path to Cypress config file",
|
|
132
205
|
CYPRESS_CONFIG_DEMAND: "Cypress config file is required",
|
|
133
206
|
BUILD_NAME: "The build name you want to use to name your test runs",
|
|
134
207
|
EXCLUDE: "Exclude files matching a pattern from zipping and uploading",
|
|
135
|
-
DEFAULT_PARALLEL_MESSAGE:
|
|
208
|
+
DEFAULT_PARALLEL_MESSAGE:
|
|
209
|
+
"Here goes the number of parallels you want to run",
|
|
136
210
|
SPECS_DESCRIPTION: "Specify the spec files to run",
|
|
137
211
|
ENV_DESCRIPTION: "Specify the environment variables for your spec files",
|
|
138
212
|
SYNC_DESCRIPTION: "Makes the run command in sync",
|
|
139
213
|
ASYNC_DESCRIPTION: "Makes the run command in async",
|
|
140
214
|
BUILD_REPORT_MESSAGE: "See the entire build report here",
|
|
141
215
|
HEADED: "Run your tests in a headed browser instead of a headless browser",
|
|
142
|
-
LOCAL:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
216
|
+
LOCAL:
|
|
217
|
+
"Accepted values: (true | false) - create a local testing connection to let you test staging and localhost websites, or sites behind proxies; learn more at browserstack.com/local-testing",
|
|
218
|
+
LOCAL_MODE:
|
|
219
|
+
'Accepted values: ("always-on" | "on-demand") - if you choose to keep the binary "always-on", it will speed up your tests by keeping the Local connection warmed up in the background; otherwise, you can choose to have it spawn and killed for every build',
|
|
220
|
+
LOCAL_IDENTIFIER:
|
|
221
|
+
"Accepted values: String - assign an identifier to your Local process instance",
|
|
222
|
+
LOCAL_CONFIG_FILE:
|
|
223
|
+
"Accepted values: String - path to local config-file to your Local process instance. Learn more at https://www.browserstack.com/local-testing/binary-params",
|
|
224
|
+
SYNC_NO_WRAP:
|
|
225
|
+
"Wrap the spec names in --sync mode in case of smaller terminal window size pass --no-wrap",
|
|
147
226
|
BROWSER_DESCRIPTION: "Specify the browsers you need to run your tests on.",
|
|
148
|
-
CONFIG_DESCRIPTION:
|
|
227
|
+
CONFIG_DESCRIPTION:
|
|
228
|
+
"Set configuration values. Separate multiple values with a comma. The values set here override any values set in your configuration file.",
|
|
149
229
|
REPORTER: "Specify the custom reporter to use",
|
|
150
230
|
REPORTER_OPTIONS: "Specify reporter options for custom reporter",
|
|
151
231
|
CYPRESS_GEO_LOCATION: "Enterprise feature to simulate website and mobile behavior from different locations.",
|
|
@@ -153,11 +233,13 @@ const cliMessages = {
|
|
|
153
233
|
RECORD: "Pass the --record flag to record your Cypress runs on Cypress.io dashboard. Note: You also need to specify '--record-key' and '--projectId' arguments either in CLI or in browserstack.json.",
|
|
154
234
|
RECORD_KEY: "You can specify the 'key' that is needed to record your runs on Cypress.io dashboard using the '--record-key' argument. Alternatively, you can also pass it on browserstack.json",
|
|
155
235
|
PROJECT_ID: "You can pass the 'projectId' of your Cypress.io project where you want to record your runs if specifying the '--record' key. You can also specify this in your cypress.json or in your browserstack.json.",
|
|
156
|
-
NODE_VERSION: "Pass the node version that you want BrowserStack to use to run your Cypress tests on."
|
|
236
|
+
NODE_VERSION: "Pass the node version that you want BrowserStack to use to run your Cypress tests on.",
|
|
237
|
+
BUILD_TAG: "Add a tag to your build to filter builds based on tag values on the Dashboard."
|
|
157
238
|
},
|
|
158
239
|
COMMON: {
|
|
159
240
|
DISABLE_USAGE_REPORTING: "Disable usage reporting",
|
|
160
|
-
FORCE_UPLOAD:
|
|
241
|
+
FORCE_UPLOAD:
|
|
242
|
+
"Force the upload of your test files even if BrowserStack has detected no changes in your suite since you last ran",
|
|
161
243
|
USERNAME: "Your BrowserStack username",
|
|
162
244
|
ACCESS_KEY: "Your BrowserStack access key",
|
|
163
245
|
NO_NPM_WARNING: "No NPM warning if npm_dependencies is empty",
|
|
@@ -166,10 +248,10 @@ const cliMessages = {
|
|
|
166
248
|
DEBUG: "Use this option to get debug logs on the CLI console.",
|
|
167
249
|
},
|
|
168
250
|
GENERATE_REPORT: {
|
|
169
|
-
INFO: "Generates the build report"
|
|
251
|
+
INFO: "Generates the build report",
|
|
170
252
|
},
|
|
171
253
|
GENERATE_DOWNLOADS: {
|
|
172
|
-
INFO: "Downloads the build artifacts"
|
|
254
|
+
INFO: "Downloads the build artifacts",
|
|
173
255
|
},
|
|
174
256
|
};
|
|
175
257
|
|
|
@@ -179,70 +261,116 @@ const messageTypes = {
|
|
|
179
261
|
INFO: "info",
|
|
180
262
|
WARNING: "warning",
|
|
181
263
|
UNKNOWN: "unknown",
|
|
182
|
-
NULL: null
|
|
183
|
-
}
|
|
264
|
+
NULL: null,
|
|
265
|
+
};
|
|
184
266
|
|
|
185
|
-
const allowedFileTypes = [
|
|
267
|
+
const allowedFileTypes = [
|
|
268
|
+
"js",
|
|
269
|
+
"json",
|
|
270
|
+
"txt",
|
|
271
|
+
"ts",
|
|
272
|
+
"feature",
|
|
273
|
+
"features",
|
|
274
|
+
"pdf",
|
|
275
|
+
"jpg",
|
|
276
|
+
"jpeg",
|
|
277
|
+
"png",
|
|
278
|
+
"zip",
|
|
279
|
+
"npmrc",
|
|
280
|
+
"xml",
|
|
281
|
+
"doc",
|
|
282
|
+
"docx",
|
|
283
|
+
"ppt",
|
|
284
|
+
"pptx",
|
|
285
|
+
"xls",
|
|
286
|
+
"xlsx",
|
|
287
|
+
"jsx",
|
|
288
|
+
"coffee",
|
|
289
|
+
"cjsx",
|
|
290
|
+
"csv",
|
|
291
|
+
"tsv",
|
|
292
|
+
"yml",
|
|
293
|
+
"yaml",
|
|
294
|
+
"env",
|
|
295
|
+
"mov",
|
|
296
|
+
"mp4",
|
|
297
|
+
"mp3",
|
|
298
|
+
"wav",
|
|
299
|
+
"gz",
|
|
300
|
+
"tgz",
|
|
301
|
+
"tiff",
|
|
302
|
+
"bmp",
|
|
303
|
+
"msg",
|
|
304
|
+
"gif",
|
|
305
|
+
"sql",
|
|
306
|
+
"pmc",
|
|
307
|
+
"pmp",
|
|
308
|
+
"max",
|
|
309
|
+
];
|
|
186
310
|
|
|
187
311
|
const filesToIgnoreWhileUploading = [
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
312
|
+
"**/node_modules/**",
|
|
313
|
+
"node_modules/**",
|
|
314
|
+
"package-lock.json",
|
|
315
|
+
"package.json",
|
|
316
|
+
"browserstack-package.json",
|
|
317
|
+
"tests.zip",
|
|
318
|
+
"cypress.json",
|
|
319
|
+
"cypress.config.js",
|
|
320
|
+
"cypress.config.ts",
|
|
321
|
+
"cypress.config.cjs",
|
|
322
|
+
"cypress.config.mjs",
|
|
323
|
+
".idea/**",
|
|
324
|
+
".vscode/**",
|
|
325
|
+
".npm/**",
|
|
326
|
+
"bstackPackages.tar.gz",
|
|
327
|
+
"tmpBstackPackages/**",
|
|
328
|
+
".yarn/**",
|
|
329
|
+
"build_artifacts/**"
|
|
202
330
|
];
|
|
203
331
|
|
|
204
332
|
const readDirOptions = {
|
|
205
|
-
cwd:
|
|
333
|
+
cwd: ".",
|
|
206
334
|
matchBase: true,
|
|
207
335
|
ignore: [],
|
|
208
336
|
dot: true,
|
|
209
337
|
stat: true,
|
|
210
|
-
pattern:
|
|
211
|
-
}
|
|
338
|
+
pattern: "",
|
|
339
|
+
};
|
|
212
340
|
|
|
213
341
|
const hashingOptions = {
|
|
214
342
|
parallel: 10,
|
|
215
|
-
algo:
|
|
216
|
-
encoding:
|
|
343
|
+
algo: "md5",
|
|
344
|
+
encoding: "hex",
|
|
217
345
|
};
|
|
218
346
|
|
|
219
347
|
const packageInstallerOptions = {
|
|
220
348
|
npmLoad: {
|
|
221
|
-
loglevel:
|
|
222
|
-
only:
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
}
|
|
349
|
+
loglevel: "silent",
|
|
350
|
+
only: "dev",
|
|
351
|
+
"save-dev": true,
|
|
352
|
+
"only-dev": true,
|
|
353
|
+
},
|
|
354
|
+
};
|
|
227
355
|
|
|
228
|
-
const specFileTypes = [
|
|
356
|
+
const specFileTypes = ["js", "ts", "feature", "jsx", "coffee", "cjsx"];
|
|
229
357
|
|
|
230
|
-
const DEFAULT_CYPRESS_SPEC_PATH = "cypress/integration"
|
|
358
|
+
const DEFAULT_CYPRESS_SPEC_PATH = "cypress/integration";
|
|
231
359
|
|
|
232
360
|
const SPEC_TOTAL_CHAR_LIMIT = 32243;
|
|
233
361
|
const METADATA_CHAR_BUFFER_PER_SPEC = 175;
|
|
234
362
|
|
|
235
363
|
const usageReportingConstants = {
|
|
236
|
-
GENERATE_DOWNLOADS:
|
|
237
|
-
}
|
|
364
|
+
GENERATE_DOWNLOADS: "generate-downloads called",
|
|
365
|
+
};
|
|
238
366
|
|
|
239
|
-
const LATEST_VERSION_SYNTAX_REGEX = /\d*.latest(.\d*)?/gm
|
|
367
|
+
const LATEST_VERSION_SYNTAX_REGEX = /\d*.latest(.\d*)?/gm;
|
|
240
368
|
|
|
241
|
-
const AUTH_REGEX = /"auth" *: *{[\s\S]*?}/g
|
|
369
|
+
const AUTH_REGEX = /"auth" *: *{[\s\S]*?}/g;
|
|
242
370
|
|
|
243
|
-
const CLI_ARGS_REGEX = /(?<=("u"|"username"|"k"|"key") *: *)"[^,}]*/g
|
|
371
|
+
const CLI_ARGS_REGEX = /(?<=("u"|"username"|"k"|"key") *: *)"[^,}]*/g;
|
|
244
372
|
|
|
245
|
-
const RAW_ARGS_REGEX = /(?<=("-u"|"-username"|"-k"|"-key") *, *)"[^,\]]*/g
|
|
373
|
+
const RAW_ARGS_REGEX = /(?<=("-u"|"-username"|"-k"|"-key") *, *)"[^,\]]*/g;
|
|
246
374
|
|
|
247
375
|
const ERROR_EXIT_CODE = 1;
|
|
248
376
|
|
|
@@ -250,12 +378,36 @@ const BUILD_FAILED_EXIT_CODE = 3;
|
|
|
250
378
|
|
|
251
379
|
const REDACTED = "[REDACTED]";
|
|
252
380
|
|
|
253
|
-
const REDACTED_AUTH
|
|
381
|
+
const REDACTED_AUTH = `auth: { "username": ${REDACTED}, "access_key": ${REDACTED} }`;
|
|
254
382
|
|
|
255
|
-
const SPEC_TIMEOUT_LIMIT = 120 // IN MINS
|
|
383
|
+
const SPEC_TIMEOUT_LIMIT = 120; // IN MINS
|
|
256
384
|
|
|
257
385
|
const CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY = "custom_errors_to_print";
|
|
258
386
|
|
|
387
|
+
const CYPRESS_V9_AND_OLDER_TYPE = "CYPRESS_V9_AND_OLDER_TYPE";
|
|
388
|
+
|
|
389
|
+
const CYPRESS_V10_AND_ABOVE_TYPE = "CYPRESS_V10_AND_ABOVE_TYPE";
|
|
390
|
+
|
|
391
|
+
const CYPRESS_CONFIG_FILE_MAPPING = {
|
|
392
|
+
"cypress.json": {
|
|
393
|
+
type: CYPRESS_V9_AND_OLDER_TYPE
|
|
394
|
+
},
|
|
395
|
+
"cypress.config.js": {
|
|
396
|
+
type: CYPRESS_V10_AND_ABOVE_TYPE
|
|
397
|
+
},
|
|
398
|
+
"cypress.config.ts": {
|
|
399
|
+
type: CYPRESS_V10_AND_ABOVE_TYPE
|
|
400
|
+
},
|
|
401
|
+
"cypress.config.mjs": {
|
|
402
|
+
type: CYPRESS_V10_AND_ABOVE_TYPE
|
|
403
|
+
},
|
|
404
|
+
"cypress.config.cjs": {
|
|
405
|
+
type: CYPRESS_V10_AND_ABOVE_TYPE
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
const CYPRESS_CONFIG_FILE_NAMES = Object.keys(CYPRESS_CONFIG_FILE_MAPPING);
|
|
410
|
+
|
|
259
411
|
module.exports = Object.freeze({
|
|
260
412
|
syncCLI,
|
|
261
413
|
userMessages,
|
|
@@ -281,5 +433,9 @@ module.exports = Object.freeze({
|
|
|
281
433
|
REDACTED,
|
|
282
434
|
BUILD_FAILED_EXIT_CODE,
|
|
283
435
|
SPEC_TIMEOUT_LIMIT,
|
|
284
|
-
CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY
|
|
436
|
+
CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY,
|
|
437
|
+
CYPRESS_V9_AND_OLDER_TYPE,
|
|
438
|
+
CYPRESS_V10_AND_ABOVE_TYPE,
|
|
439
|
+
CYPRESS_CONFIG_FILE_MAPPING,
|
|
440
|
+
CYPRESS_CONFIG_FILE_NAMES
|
|
285
441
|
});
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
fileHelpers = require('./fileHelpers'),
|
|
6
6
|
logger = require("./logger").winstonLogger,
|
|
7
7
|
Constants = require('./constants'),
|
|
8
|
-
process = require('process'),
|
|
9
8
|
utils = require('./utils'),
|
|
9
|
+
{ get_version } = require('./usageReporting'),
|
|
10
|
+
process = require('process'),
|
|
10
11
|
{ spawn } = require('child_process'),
|
|
11
12
|
util = require('util');
|
|
12
13
|
|
|
@@ -64,7 +65,7 @@ const packageInstall = (packageDir) => {
|
|
|
64
65
|
logger.info(`Packages were installed locally successfully.`);
|
|
65
66
|
resolve('Packages were installed successfully.');
|
|
66
67
|
} else {
|
|
67
|
-
logger.error(`Some error occurred while installing packages. Error code ${code}
|
|
68
|
+
logger.error(`Some error occurred while installing packages. Error code ${code}. Please read npm_install_debug.log for more info.`);
|
|
68
69
|
reject(`Packages were not installed successfully. Error code ${code}`);
|
|
69
70
|
}
|
|
70
71
|
};
|
|
@@ -72,7 +73,22 @@ const packageInstall = (packageDir) => {
|
|
|
72
73
|
logger.error(`Some error occurred while installing packages: %j`, error);
|
|
73
74
|
reject(`Packages were not installed successfully. Error Description ${util.format('%j', error)}`);
|
|
74
75
|
};
|
|
75
|
-
|
|
76
|
+
|
|
77
|
+
let nodeProcess;
|
|
78
|
+
logger.debug(`Fetching npm version and its major version`);
|
|
79
|
+
const npm_version = get_version('npm')
|
|
80
|
+
const npm_major_version = utils.getMajorVersion(npm_version);
|
|
81
|
+
logger.debug(`Fetched npm version: ${npm_version} and its major version: ${npm_major_version}`);
|
|
82
|
+
|
|
83
|
+
// add --legacy-peer-deps flag while installing dependencies for npm v7+
|
|
84
|
+
// For more info please read "Peer Dependencies" section here -> https://github.blog/2021-02-02-npm-7-is-now-generally-available/
|
|
85
|
+
if (parseInt(npm_major_version) >= 7) {
|
|
86
|
+
logger.debug(`Running NPM install command: npm install --legacy-peer-deps --loglevel verbose > ../npm_install_debug.log`);
|
|
87
|
+
nodeProcess = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['install', '--legacy-peer-deps', '--loglevel', 'verbose', '>', '../npm_install_debug.log', '2>&1'], {cwd: packageDir, shell: true});
|
|
88
|
+
} else {
|
|
89
|
+
logger.debug(`Running NPM install command: 'npm install --loglevel verbose > ../npm_install_debug.log'`);
|
|
90
|
+
nodeProcess = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['install', '--loglevel', 'verbose', '>', '../npm_install_debug.log', '2>&1'], {cwd: packageDir, shell: true});
|
|
91
|
+
}
|
|
76
92
|
nodeProcess.on('close', nodeProcessCloseCallback);
|
|
77
93
|
nodeProcess.on('error', nodeProcessErrorCallback);
|
|
78
94
|
});
|