diff --git a/bin/helpers/constants.js b/bin/helpers/constants.js index f03ed4a7..fbbded4c 100644 --- a/bin/helpers/constants.js +++ b/bin/helpers/constants.js @@ -1,72 +1,115 @@ let config = require("./config"); -let chalk = require('chalk'); +let chalk = require("chalk"); const syncCLI = { - FAILED_SPEC_DETAILS_COL_HEADER: ['Spec', 'Status', 'Browser', 'BrowserStack Session ID'], + FAILED_SPEC_DETAILS_COL_HEADER: [ + "Spec", + "Status", + "Browser", + "BrowserStack Session ID", + ], LOGS: { - INIT_LOG: "All tests:" + INIT_LOG: "All tests:", }, INITIAL_DELAY_MULTIPLIER: 10, - DEFAULT_LINE_SEP: "\n--------------------------------------------------------------------------------", - STARTUP_MESSAGE: "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..." + DEFAULT_LINE_SEP: + "\n--------------------------------------------------------------------------------", + STARTUP_MESSAGE: + "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...", }; const userMessages = { BUILD_FAILED: "Build creation failed.", - BUILD_GENERATE_REPORT_FAILED: "Generating report for the build failed.", + BUILD_GENERATE_REPORT_FAILED: + "Generating report for the build failed.", BUILD_CREATED: "Build created", BUILD_INFO_FAILED: "Failed to get build info.", BUILD_STOP_FAILED: "Failed to stop build.", BUILD_REPORT_MESSAGE: "See the entire build report here:", - ZIP_UPLOADER_NOT_REACHABLE: "Could not reach BrowserStack APIs. Please check your network or see if you need to whitelist *.browserstack.com", + ZIP_UPLOADER_NOT_REACHABLE: + "Could not reach BrowserStack APIs. Please check your network or see if you need to whitelist *.browserstack.com", ZIP_UPLOAD_FAILED: "Zip Upload failed.", - ZIP_UPLOAD_LIMIT_EXCEEDED: "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", - NODE_MODULES_LIMIT_EXCEEDED: "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.", - CONFIG_FILE_CREATED: "BrowserStack Config File created, you can now run browserstack-cypress --config-file run", - CONFIG_FILE_EXISTS: "File already exists, delete the browserstack.json file manually. skipping...", - DIR_NOT_FOUND: "Given path does not exist. Failed to create browserstack.json in %s", - MD5_CHECK_FAILED: "There was some issue while checking if zip is already uploaded.", + ZIP_UPLOAD_LIMIT_EXCEEDED: + "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", + NODE_MODULES_LIMIT_EXCEEDED: + "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.", + CONFIG_FILE_CREATED: + "BrowserStack Config File created, you can now run browserstack-cypress --config-file run", + CONFIG_FILE_EXISTS: + "File already exists, delete the browserstack.json file manually. skipping...", + DIR_NOT_FOUND: + "Given path does not exist. Failed to create browserstack.json in %s", + MD5_CHECK_FAILED: + "There was some issue while checking if zip is already uploaded.", ZIP_DELETE_FAILED: "Could not delete tests.zip successfully.", ZIP_DELETED: "Deleted tests.zip successfully.", - NPM_INSTALL_AND_UPLOAD: "Installing required dependencies and building the package to upload to BrowserStack", + NPM_INSTALL_AND_UPLOAD: + "Installing required dependencies and building the package to upload to BrowserStack", NPM_DELETE_FAILED: "Could not delete the dependency packages.", NPM_DELETED: "Deleted dependency packages successfully.", - API_DEPRECATED: "This version of API is deprecated, please use latest version of API.", + API_DEPRECATED: + "This version of API is deprecated, please use latest version of API.", FAILED_TO_ZIP: "Failed to zip files.", - FAILED_CREATE_NPM_ARCHIVE: "CLI execution failed due to some issue in npm setup. Please retry.", - FAILED_MD5_CHECK: "Something went wrong - you can retry running browserstack-cypress with ‘--force-upload’ parameter, or contact BrowserStack Support.", + FAILED_CREATE_NPM_ARCHIVE: + "CLI execution failed due to some issue in npm setup. Please retry.", + FAILED_MD5_CHECK: + "Something went wrong - you can retry running browserstack-cypress with ‘--force-upload’ parameter, or contact BrowserStack Support.", VISIT_DASHBOARD: "Visit the Automate dashboard for real-time test reporting:", - CONFLICTING_INIT_ARGUMENTS: "Conflicting arguments given. You can use --path only with a file name, and not with a file path.", - NO_PARALLELS: "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", - NO_NPM_DEPENDENCIES: "No npm dependencies specified - your specs might fail if they need any packages to be installed before running.", - NO_NPM_DEPENDENCIES_READ_MORE: "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.", + CONFLICTING_INIT_ARGUMENTS: + "Conflicting arguments given. You can use --path only with a file name, and not with a file path.", + NO_PARALLELS: + "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", + NO_NPM_DEPENDENCIES: + "No npm dependencies specified - your specs might fail if they need any packages to be installed before running.", + NO_NPM_DEPENDENCIES_READ_MORE: + "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.", VALIDATING_CONFIG: "Validating the config", UPLOADING_TESTS: "Uploading the tests to BrowserStack", UPLOADING_TESTS_SUCCESS: "Uploaded tests successfully", UPLOADING_NPM_PACKAGES: "Uploading required node_modules to BrowserStack", UPLOADING_NPM_PACKAGES_SUCCESS: "Uploaded node_modules successfully", - SKIP_UPLOADING_TESTS: "Skipping zip upload since BrowserStack already has your test suite that has not changed since the last run.", - SKIP_UPLOADING_NPM_PACKAGES: "Skipping the upload of node_modules since BrowserStack has already cached your npm dependencies that have not changed since the last run.", + SKIP_UPLOADING_TESTS: + "Skipping zip upload since BrowserStack already has your test suite that has not changed since the last run.", + SKIP_UPLOADING_NPM_PACKAGES: + "Skipping the upload of node_modules since BrowserStack has already cached your npm dependencies that have not changed since the last run.", LOCAL_TRUE: "you will now be able to test localhost / private URLs", LOCAL_FALSE: "you won't be able to test localhost / private URLs", - EXIT_SYNC_CLI_MESSAGE: "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 command now.", + EXIT_SYNC_CLI_MESSAGE: + "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 command now.", FATAL_NETWORK_ERROR: `fatal: unable to access '${config.buildUrl}': Could not resolve host: ${config.rails_host}`, RETRY_LIMIT_EXCEEDED: `Max retries exceeded trying to connect to the host (retries: ${config.retries})`, CHECK_DASHBOARD_AT: "Please check the build status at: ", - CYPRESS_VERSION_CHANGED: "Your build will run using Cypress instead of Cypress . Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions", + CYPRESS_VERSION_CHANGED: + "Your build will run using Cypress instead of Cypress . Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions", LOCAL_START_FAILED: "Local Testing setup failed.", LOCAL_STOP_FAILED: "Local Binary stop failed.", - INVALID_LOCAL_MODE_WARNING: "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", - LOCAL_BINARY_ALREADY_RUNNING: "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.", - SPEC_LIMIT_WARNING: "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.", - DOWNLOAD_BUILD_ARTIFACTS_FAILED: "Downloading build artifacts for the build failed for machines.", - ASYNC_DOWNLOADS: "Test artifacts as specified under 'downloads' can be downloaded after the build has completed its run, using 'browserstack-cypress generate-downloads '", - DOWNLOAD_BUILD_ARTIFACTS_SUCCESS: "Your build artifact(s) have been successfully downloaded in '/build_artifacts/' directory", - LATEST_SYNTAX_TO_ACTUAL_VERSION_MESSAGE: "Your build will run using Cypress as you had specified . Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions", - PROCESS_KILL_MESSAGE: "Stopping the CLI and the execution of the build on BrowserStack", - BUILD_FAILED_ERROR: "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 " + chalk.blueBright("https://www.browserstack.com/docs/automate/cypress/npm-packages") + ". 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 " + chalk.blueBright("https://www.browserstack.com/contact#technical-support"), - SPEC_TIMEOUT_LIMIT_WARNING: "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", - SPEC_LIMIT_SUCCESS_MESSAGE: "Spec timeout specified as minutes. If any of your specs exceed the specified time limit, it would be forcibly killed by BrowserStack" + INVALID_LOCAL_MODE_WARNING: + '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', + LOCAL_BINARY_ALREADY_RUNNING: + "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.", + SPEC_LIMIT_WARNING: + "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.", + DOWNLOAD_BUILD_ARTIFACTS_FAILED: + "Downloading build artifacts for the build failed for machines.", + ASYNC_DOWNLOADS: + "Test artifacts as specified under 'downloads' can be downloaded after the build has completed its run, using 'browserstack-cypress generate-downloads '", + DOWNLOAD_BUILD_ARTIFACTS_SUCCESS: + "Your build artifact(s) have been successfully downloaded in '/build_artifacts/' directory", + LATEST_SYNTAX_TO_ACTUAL_VERSION_MESSAGE: + "Your build will run using Cypress as you had specified . Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions", + PROCESS_KILL_MESSAGE: + "Stopping the CLI and the execution of the build on BrowserStack", + BUILD_FAILED_ERROR: + "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 " + + chalk.blueBright( + "https://www.browserstack.com/docs/automate/cypress/npm-packages" + ) + + ". 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 " + + chalk.blueBright("https://www.browserstack.com/contact#technical-support"), + SPEC_TIMEOUT_LIMIT_WARNING: + "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", + SPEC_LIMIT_SUCCESS_MESSAGE: + "Spec timeout specified as minutes. If any of your specs exceed the specified time limit, it would be forcibly killed by BrowserStack", }; const validationMessages = { @@ -75,37 +118,62 @@ const validationMessages = { EMPTY_TEST_SUITE: "Test suite is empty", EMPTY_BROWSERSTACK_JSON: "Empty browserstack.json", EMPTY_RUN_SETTINGS: "Empty run settings", - EMPTY_CYPRESS_PROJ_DIR: "cypress_proj_dir is not set in run_settings. See https://www.browserstack.com/docs/automate/cypress/sample-tutorial to learn more.", + EMPTY_CYPRESS_PROJ_DIR: + "cypress_proj_dir is not set in run_settings. See https://www.browserstack.com/docs/automate/cypress/sample-tutorial to learn more.", VALIDATED: "browserstack.json file is validated", NOT_VALID: "browerstack.json is not valid", NOT_VALID_JSON: "browerstack.json is not a valid json", INVALID_EXTENSION: "Invalid files, please remove these files and try again.", - INVALID_PARALLELS_CONFIGURATION: "Invalid value specified for parallels to use. Maximum parallels to use should be a number greater than 0.", + INVALID_PARALLELS_CONFIGURATION: + "Invalid value specified for parallels to use. Maximum parallels to use should be a number greater than 0.", INVALID_CYPRESS_CONFIG_FILE: "Invalid cypress_config_file", - CYPRESS_JSON_NOT_FOUND: "cypress.json file is not found at cypress_proj_dir path ", + CYPRESS_JSON_NOT_FOUND: + "cypress.json file is not found at cypress_proj_dir path ", INVALID_CYPRESS_JSON: "cypress.json is not a valid json", - INVALID_DEFAULT_AUTH_PARAMS: "Your username and access key are required to run your tests on BrowserStack. Learn more at https://www.browserstack.com/docs/automate/cypress/authentication", - LOCAL_NOT_SET: "To test on BrowserStack, you will have to set up Local testing. Read more here: https://www.browserstack.com/docs/automate/cypress/local-testing", - INCORRECT_DIRECTORY_STRUCTURE: "No tests to run. Note that your Cypress tests should be in the same directory where the cypress.json exists.", - INVALID_CLI_LOCAL_IDENTIFIER: "When using --local-identifier, a value needs to be supplied. \n--local-identifier .\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference", - INVALID_LOCAL_MODE: "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", - INVALID_LOCAL_CONFIG_FILE: "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", - INVALID_LOCAL_IDENTIFIER: "Invalid value specified for local_identifier. For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference", - INVALID_BROWSER_ARGS: "Aborting as an unacceptable value was passed for --browser. Read more at https://www.browserstack.com/docs/automate/cypress/cli-reference", - INVALID_LOCAL_ASYNC_ARGS: "Cannot run in --async mode when local is set to true. Please run the build after removing --async", - INVALID_GEO_LOCATION: "[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", - NOT_SUPPORTED_GEO_LOCATION: "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.", - NOT_AVAILABLE_GEO_LOCATION: "The country code you have passed for IP Geolocation is not available at the moment. Please try again in a few hours.", - ACCESS_DENIED_GEO_LOCATION: "'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.", - NOT_ALLOWED_GEO_LOCATION_AND_LOCAL_MODE: "IP Geolocation feature is not available in conjunction with BrowserStack Local.", - HOME_DIRECTORY_NOT_FOUND: "Specified home directory could not be found. Please make sure the path of the home directory is correct.", - HOME_DIRECTORY_NOT_A_DIRECTORY: "Specified home directory is not a directory. The home directory can only be a directory and not a file.", - CYPRESS_CONFIG_FILE_NOT_PART_OF_HOME_DIRECTORY: "Could not find cypress.json within the specified home directory. Please make sure cypress.json resides within the home directory.", - SPEC_TIMEOUT_LIMIT_ERROR: "The maximum allowed value of 'spec_timeout' is 120. Read more on https://browserstack.com/docs/automate/cypress/spec-timeout ", - SPEC_TIMEOUT_NOT_PASSED_ERROR: "'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 ", - PROJECT_ID_MISSING: "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", - RECORD_KEY_MISSING: "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", - NODE_VERSION_PARSING_ERROR: "We weren't able to successfully parse the specified nodeVersion. We will be using the default nodeVersion to run your tests." + INVALID_DEFAULT_AUTH_PARAMS: + "Your username and access key are required to run your tests on BrowserStack. Learn more at https://www.browserstack.com/docs/automate/cypress/authentication", + LOCAL_NOT_SET: + "To test on BrowserStack, you will have to set up Local testing. Read more here: https://www.browserstack.com/docs/automate/cypress/local-testing", + INCORRECT_DIRECTORY_STRUCTURE: + "No tests to run. Note that your Cypress tests should be in the same directory where the cypress.json exists.", + INVALID_CLI_LOCAL_IDENTIFIER: + "When using --local-identifier, a value needs to be supplied. \n--local-identifier .\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference", + INVALID_LOCAL_MODE: + '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', + INVALID_LOCAL_CONFIG_FILE: + "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", + INVALID_LOCAL_IDENTIFIER: + "Invalid value specified for local_identifier. For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference", + INVALID_BROWSER_ARGS: + "Aborting as an unacceptable value was passed for --browser. Read more at https://www.browserstack.com/docs/automate/cypress/cli-reference", + INVALID_LOCAL_ASYNC_ARGS: + "Cannot run in --async mode when local is set to true. Please run the build after removing --async", + INVALID_GEO_LOCATION: + "[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", + NOT_SUPPORTED_GEO_LOCATION: + "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.", + NOT_AVAILABLE_GEO_LOCATION: + "The country code you have passed for IP Geolocation is not available at the moment. Please try again in a few hours.", + ACCESS_DENIED_GEO_LOCATION: + "'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.", + NOT_ALLOWED_GEO_LOCATION_AND_LOCAL_MODE: + "IP Geolocation feature is not available in conjunction with BrowserStack Local.", + HOME_DIRECTORY_NOT_FOUND: + "Specified home directory could not be found. Please make sure the path of the home directory is correct.", + HOME_DIRECTORY_NOT_A_DIRECTORY: + "Specified home directory is not a directory. The home directory can only be a directory and not a file.", + CYPRESS_CONFIG_FILE_NOT_PART_OF_HOME_DIRECTORY: + "Could not find cypress.json within the specified home directory. Please make sure cypress.json resides within the home directory.", + SPEC_TIMEOUT_LIMIT_ERROR: + "The maximum allowed value of 'spec_timeout' is 120. Read more on https://browserstack.com/docs/automate/cypress/spec-timeout ", + SPEC_TIMEOUT_NOT_PASSED_ERROR: + "'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 ", + PROJECT_ID_MISSING: + "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", + RECORD_KEY_MISSING: + "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", + NODE_VERSION_PARSING_ERROR: + "We weren't able to successfully parse the specified nodeVersion. We will be using the default nodeVersion to run your tests.", }; const cliMessages = { @@ -126,26 +194,34 @@ const cliMessages = { STOP_MESSAGE: "Stopping build with given buildId ", }, RUN: { - PARALLEL_DESC: "The maximum number of parallels to use to run your test suite", + PARALLEL_DESC: + "The maximum number of parallels to use to run your test suite", INFO: "Run your tests on BrowserStack. For more help: `browserstack-cypress run --help`.", CYPRESS_DESC: "Path to Cypress config file", CYPRESS_CONFIG_DEMAND: "Cypress config file is required", BUILD_NAME: "The build name you want to use to name your test runs", EXCLUDE: "Exclude files matching a pattern from zipping and uploading", - DEFAULT_PARALLEL_MESSAGE: "Here goes the number of parallels you want to run", + DEFAULT_PARALLEL_MESSAGE: + "Here goes the number of parallels you want to run", SPECS_DESCRIPTION: "Specify the spec files to run", ENV_DESCRIPTION: "Specify the environment variables for your spec files", SYNC_DESCRIPTION: "Makes the run command in sync", ASYNC_DESCRIPTION: "Makes the run command in async", BUILD_REPORT_MESSAGE: "See the entire build report here", HEADED: "Run your tests in a headed browser instead of a headless browser", - LOCAL: "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", - LOCAL_MODE: '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', - LOCAL_IDENTIFIER: "Accepted values: String - assign an identifier to your Local process instance", - LOCAL_CONFIG_FILE: "Accepted values: String - path to local config-file to your Local process instance. Learn more at https://www.browserstack.com/local-testing/binary-params", - SYNC_NO_WRAP: "Wrap the spec names in --sync mode in case of smaller terminal window size pass --no-wrap", + LOCAL: + "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", + LOCAL_MODE: + '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', + LOCAL_IDENTIFIER: + "Accepted values: String - assign an identifier to your Local process instance", + LOCAL_CONFIG_FILE: + "Accepted values: String - path to local config-file to your Local process instance. Learn more at https://www.browserstack.com/local-testing/binary-params", + SYNC_NO_WRAP: + "Wrap the spec names in --sync mode in case of smaller terminal window size pass --no-wrap", BROWSER_DESCRIPTION: "Specify the browsers you need to run your tests on.", - CONFIG_DESCRIPTION: "Set configuration values. Separate multiple values with a comma. The values set here override any values set in your configuration file.", + CONFIG_DESCRIPTION: + "Set configuration values. Separate multiple values with a comma. The values set here override any values set in your configuration file.", REPORTER: "Specify the custom reporter to use", REPORTER_OPTIONS: "Specify reporter options for custom reporter", CYPRESS_GEO_LOCATION: "Enterprise feature to simulate website and mobile behavior from different locations.", @@ -158,7 +234,8 @@ const cliMessages = { }, COMMON: { DISABLE_USAGE_REPORTING: "Disable usage reporting", - FORCE_UPLOAD: "Force the upload of your test files even if BrowserStack has detected no changes in your suite since you last ran", + FORCE_UPLOAD: + "Force the upload of your test files even if BrowserStack has detected no changes in your suite since you last ran", USERNAME: "Your BrowserStack username", ACCESS_KEY: "Your BrowserStack access key", NO_NPM_WARNING: "No NPM warning if npm_dependencies is empty", @@ -167,10 +244,10 @@ const cliMessages = { DEBUG: "Use this option to get debug logs on the CLI console.", }, GENERATE_REPORT: { - INFO: "Generates the build report" + INFO: "Generates the build report", }, GENERATE_DOWNLOADS: { - INFO: "Downloads the build artifacts" + INFO: "Downloads the build artifacts", }, }; @@ -180,70 +257,112 @@ const messageTypes = { INFO: "info", WARNING: "warning", UNKNOWN: "unknown", - NULL: null -} + NULL: null, +}; -const allowedFileTypes = ['js', 'json', 'txt', 'ts', 'feature', 'features', 'pdf', 'jpg', 'jpeg', 'png', 'zip', 'npmrc', 'xml', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'jsx', 'coffee', 'cjsx', 'csv', 'tsv', 'yml', 'yaml', 'env', 'mov', 'mp4', 'mp3', 'wav', 'gz', 'tgz', 'tiff', 'bmp', 'msg', 'gif', 'sql']; +const allowedFileTypes = [ + "js", + "json", + "txt", + "ts", + "feature", + "features", + "pdf", + "jpg", + "jpeg", + "png", + "zip", + "npmrc", + "xml", + "doc", + "docx", + "ppt", + "pptx", + "xls", + "xlsx", + "jsx", + "coffee", + "cjsx", + "csv", + "tsv", + "yml", + "yaml", + "env", + "mov", + "mp4", + "mp3", + "wav", + "gz", + "tgz", + "tiff", + "bmp", + "msg", + "gif", + "sql", + "pmc", + "pmp", + "max", +]; const filesToIgnoreWhileUploading = [ - '**/node_modules/**', - 'node_modules/**', - 'package-lock.json', - 'package.json', - 'browserstack-package.json', - 'tests.zip', - 'cypress.json', - '.idea/**', - '.vscode/**', - '.npm/**', - 'bstackPackages.tar.gz', - 'tmpBstackPackages/**', - '.yarn/**', - 'build_artifacts/**' + "**/node_modules/**", + "node_modules/**", + "package-lock.json", + "package.json", + "browserstack-package.json", + "tests.zip", + "cypress.json", + ".idea/**", + ".vscode/**", + ".npm/**", + "bstackPackages.tar.gz", + "tmpBstackPackages/**", + ".yarn/**", + "build_artifacts/**", ]; const readDirOptions = { - cwd: '.', + cwd: ".", matchBase: true, ignore: [], dot: true, stat: true, - pattern: '' -} + pattern: "", +}; const hashingOptions = { parallel: 10, - algo: 'md5', - encoding: 'hex', + algo: "md5", + encoding: "hex", }; const packageInstallerOptions = { npmLoad: { - loglevel: 'silent', - only: 'dev', - 'save-dev': true, - 'only-dev': true, - } -} + loglevel: "silent", + only: "dev", + "save-dev": true, + "only-dev": true, + }, +}; -const specFileTypes = ['js', 'ts', 'feature', 'jsx', 'coffee', 'cjsx']; +const specFileTypes = ["js", "ts", "feature", "jsx", "coffee", "cjsx"]; -const DEFAULT_CYPRESS_SPEC_PATH = "cypress/integration" +const DEFAULT_CYPRESS_SPEC_PATH = "cypress/integration"; const SPEC_TOTAL_CHAR_LIMIT = 32243; const METADATA_CHAR_BUFFER_PER_SPEC = 175; const usageReportingConstants = { - GENERATE_DOWNLOADS: 'generate-downloads called', -} + GENERATE_DOWNLOADS: "generate-downloads called", +}; -const LATEST_VERSION_SYNTAX_REGEX = /\d*.latest(.\d*)?/gm +const LATEST_VERSION_SYNTAX_REGEX = /\d*.latest(.\d*)?/gm; -const AUTH_REGEX = /"auth" *: *{[\s\S]*?}/g +const AUTH_REGEX = /"auth" *: *{[\s\S]*?}/g; -const CLI_ARGS_REGEX = /(?<=("u"|"username"|"k"|"key") *: *)"[^,}]*/g +const CLI_ARGS_REGEX = /(?<=("u"|"username"|"k"|"key") *: *)"[^,}]*/g; -const RAW_ARGS_REGEX = /(?<=("-u"|"-username"|"-k"|"-key") *, *)"[^,\]]*/g +const RAW_ARGS_REGEX = /(?<=("-u"|"-username"|"-k"|"-key") *, *)"[^,\]]*/g; const ERROR_EXIT_CODE = 1; @@ -251,9 +370,9 @@ const BUILD_FAILED_EXIT_CODE = 3; const REDACTED = "[REDACTED]"; -const REDACTED_AUTH =`auth: { "username": ${REDACTED}, "access_key": ${REDACTED} }`; +const REDACTED_AUTH = `auth: { "username": ${REDACTED}, "access_key": ${REDACTED} }`; -const SPEC_TIMEOUT_LIMIT = 120 // IN MINS +const SPEC_TIMEOUT_LIMIT = 120; // IN MINS const CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY = "custom_errors_to_print"; @@ -282,5 +401,5 @@ module.exports = Object.freeze({ REDACTED, BUILD_FAILED_EXIT_CODE, SPEC_TIMEOUT_LIMIT, - CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY + CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY, });