browserstack-cypress-cli 1.21.0 → 1.22.1
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/.nyc_output/2807648c-3b13-4cd1-b949-11ce1b846277.json +1 -0
- package/.nyc_output/48e04c5a-5723-4547-b9d6-20074786acab.json +1 -0
- package/.nyc_output/51e8de95-1005-492b-8e2f-d7c6fc9148e4.json +1 -0
- package/.nyc_output/577e3334-ad22-4b05-ac7f-e0038582bb25.json +1 -0
- package/.nyc_output/59cc8cf4-849a-4cb5-bc52-0133091e0584.json +1 -0
- package/.nyc_output/5fc28c76-8c92-44e9-9bae-ec2e85892509.json +1 -0
- package/.nyc_output/5fffbcf8-4572-45c7-948f-38aeb3421a3e.json +1 -0
- package/.nyc_output/6b02b68b-ad99-40ff-b34f-218d98a9c773.json +1 -0
- package/.nyc_output/6ec27c2e-3529-412c-a82b-d1b8970a52a5.json +1 -0
- package/.nyc_output/7540c691-20e7-4eb9-a21e-75f1b22fe6eb.json +1 -0
- package/.nyc_output/79dc2aeb-d682-45b3-8430-eea8b886e5ae.json +1 -0
- package/.nyc_output/processinfo/2807648c-3b13-4cd1-b949-11ce1b846277.json +1 -0
- package/.nyc_output/processinfo/48e04c5a-5723-4547-b9d6-20074786acab.json +1 -0
- package/.nyc_output/processinfo/51e8de95-1005-492b-8e2f-d7c6fc9148e4.json +1 -0
- package/.nyc_output/processinfo/577e3334-ad22-4b05-ac7f-e0038582bb25.json +1 -0
- package/.nyc_output/processinfo/59cc8cf4-849a-4cb5-bc52-0133091e0584.json +1 -0
- package/.nyc_output/processinfo/5fc28c76-8c92-44e9-9bae-ec2e85892509.json +1 -0
- package/.nyc_output/processinfo/5fffbcf8-4572-45c7-948f-38aeb3421a3e.json +1 -0
- package/.nyc_output/processinfo/6b02b68b-ad99-40ff-b34f-218d98a9c773.json +1 -0
- package/.nyc_output/processinfo/6ec27c2e-3529-412c-a82b-d1b8970a52a5.json +1 -0
- package/.nyc_output/processinfo/7540c691-20e7-4eb9-a21e-75f1b22fe6eb.json +1 -0
- package/.nyc_output/processinfo/79dc2aeb-d682-45b3-8430-eea8b886e5ae.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/bin/commands/runs.js +17 -6
- package/bin/helpers/capabilityHelper.js +24 -24
- package/bin/helpers/checkUploaded.js +1 -1
- package/bin/helpers/config.js +2 -0
- package/bin/helpers/constants.js +17 -4
- package/bin/helpers/getInitialDetails.js +3 -0
- package/bin/helpers/packageInstaller.js +33 -11
- package/bin/helpers/readCypressConfigUtil.js +116 -0
- package/bin/helpers/requireModule.js +14 -0
- package/bin/helpers/utils.js +85 -9
- package/bin/helpers/zipUpload.js +1 -0
- package/log/usage.log +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","pid":96855,"argv":["/Users/archish/.nvm/versions/node/v12.18.3/bin/node","/Users/archish/.nvm/versions/node/v12.18.3/bin/browserstack-cypress","--version"],"execArgv":[],"cwd":"/Users/archish/browserstack/browserstack-cypress-cli","time":1675924393523,"ppid":96762,"coverageFilename":"/Users/archish/browserstack/browserstack-cypress-cli/.nyc_output/2807648c-3b13-4cd1-b949-11ce1b846277.json","externalId":"","uuid":"2807648c-3b13-4cd1-b949-11ce1b846277","files":["/Users/archish/browserstack/browserstack-cypress-cli/bin/runner.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/logger.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/constants.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/config.js"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","pid":96856,"argv":["/Users/archish/.nvm/versions/node/v12.18.3/bin/node","/Users/archish/.nvm/versions/node/v12.18.3/bin/npm","root","-g"],"execArgv":[],"cwd":"/Users/archish/browserstack/browserstack-cypress-cli","time":1675924393770,"ppid":96762,"coverageFilename":"/Users/archish/browserstack/browserstack-cypress-cli/.nyc_output/48e04c5a-5723-4547-b9d6-20074786acab.json","externalId":"","uuid":"48e04c5a-5723-4547-b9d6-20074786acab","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","pid":96798,"argv":["/Users/archish/.nvm/versions/node/v12.18.3/bin/node","/Users/archish/.nvm/versions/node/v12.18.3/bin/npm","root","-g"],"execArgv":[],"cwd":"/Users/archish/browserstack/browserstack-cypress-cli","time":1675924392726,"ppid":96762,"coverageFilename":"/Users/archish/browserstack/browserstack-cypress-cli/.nyc_output/51e8de95-1005-492b-8e2f-d7c6fc9148e4.json","externalId":"","uuid":"51e8de95-1005-492b-8e2f-d7c6fc9148e4","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","pid":96857,"argv":["/Users/archish/.nvm/versions/node/v12.18.3/bin/node","/Users/archish/.nvm/versions/node/v12.18.3/bin/npm","--version"],"execArgv":[],"cwd":"/Users/archish/browserstack/browserstack-cypress-cli","time":1675924394076,"ppid":96762,"coverageFilename":"/Users/archish/browserstack/browserstack-cypress-cli/.nyc_output/577e3334-ad22-4b05-ac7f-e0038582bb25.json","externalId":"","uuid":"577e3334-ad22-4b05-ac7f-e0038582bb25","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":null,"pid":96762,"argv":["/Users/archish/.nvm/versions/node/v12.18.3/bin/node","/Users/archish/browserstack/browserstack-cypress-cli/node_modules/.bin/mocha","test/**/*.js","--recursive","--timeout","60000","--exit"],"execArgv":[],"cwd":"/Users/archish/browserstack/browserstack-cypress-cli","time":1675924386931,"ppid":96750,"coverageFilename":"/Users/archish/browserstack/browserstack-cypress-cli/.nyc_output/59cc8cf4-849a-4cb5-bc52-0133091e0584.json","externalId":"","uuid":"59cc8cf4-849a-4cb5-bc52-0133091e0584","files":["/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/buildArtifacts.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/logger.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/utils.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/usageReporting.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/config.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/constants.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/fileHelpers.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/init.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/capabilityHelper.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/getInitialDetails.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/hashUtil.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/packageInstaller.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/sync/failedSpecsDetails.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/sync/specsSummary.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/sync/syncSpecsLogs.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/timeComponents.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/zipUpload.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/generateDownloads.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/generateReport.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/info.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/templates/configTemplate.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/runs.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/archiver.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/build.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/syncRunner.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/checkUploaded.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/reporterHTML.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/downloadBuildStacktrace.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/package-diff.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/stop.js"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","pid":96862,"argv":["/Users/archish/.nvm/versions/node/v12.18.3/bin/node","/Users/archish/.nvm/versions/node/v12.18.3/bin/npm","--version"],"execArgv":[],"cwd":"/Users/archish/browserstack/browserstack-cypress-cli","time":1675924395357,"ppid":96762,"coverageFilename":"/Users/archish/browserstack/browserstack-cypress-cli/.nyc_output/5fc28c76-8c92-44e9-9bae-ec2e85892509.json","externalId":"","uuid":"5fc28c76-8c92-44e9-9bae-ec2e85892509","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","pid":96860,"argv":["/Users/archish/.nvm/versions/node/v12.18.3/bin/node","/Users/archish/.nvm/versions/node/v12.18.3/bin/npm","--version"],"execArgv":[],"cwd":"/Users/archish/browserstack/browserstack-cypress-cli","time":1675924394868,"ppid":96762,"coverageFilename":"/Users/archish/browserstack/browserstack-cypress-cli/.nyc_output/5fffbcf8-4572-45c7-948f-38aeb3421a3e.json","externalId":"","uuid":"5fffbcf8-4572-45c7-948f-38aeb3421a3e","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","pid":96851,"argv":["/Users/archish/.nvm/versions/node/v12.18.3/bin/node","/Users/archish/.nvm/versions/node/v12.18.3/bin/npm","--version"],"execArgv":[],"cwd":"/Users/archish/browserstack/browserstack-cypress-cli","time":1675924393191,"ppid":96762,"coverageFilename":"/Users/archish/browserstack/browserstack-cypress-cli/.nyc_output/6b02b68b-ad99-40ff-b34f-218d98a9c773.json","externalId":"","uuid":"6b02b68b-ad99-40ff-b34f-218d98a9c773","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","pid":96779,"argv":["/Users/archish/.nvm/versions/node/v12.18.3/bin/node","/Users/archish/.nvm/versions/node/v12.18.3/bin/browserstack-cypress","--version"],"execArgv":[],"cwd":"/Users/archish/browserstack/browserstack-cypress-cli","time":1675924392447,"ppid":96762,"coverageFilename":"/Users/archish/browserstack/browserstack-cypress-cli/.nyc_output/6ec27c2e-3529-412c-a82b-d1b8970a52a5.json","externalId":"","uuid":"6ec27c2e-3529-412c-a82b-d1b8970a52a5","files":["/Users/archish/browserstack/browserstack-cypress-cli/bin/runner.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/logger.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/constants.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/config.js"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":null,"pid":96750,"argv":["/Users/archish/.nvm/versions/node/v12.18.3/bin/node","/Users/archish/browserstack/browserstack-cypress-cli/node_modules/.bin/nyc","mocha","test/**/*.js","--recursive","--timeout","60000","--exit"],"execArgv":[],"cwd":"/Users/archish/browserstack/browserstack-cypress-cli","time":1675924384473,"ppid":96747,"coverageFilename":"/Users/archish/browserstack/browserstack-cypress-cli/.nyc_output/7540c691-20e7-4eb9-a21e-75f1b22fe6eb.json","externalId":"","uuid":"7540c691-20e7-4eb9-a21e-75f1b22fe6eb","files":["/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/generateDownloads.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/generateReport.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/info.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/init.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/runs.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/stop.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/archiver.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/build.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/buildArtifacts.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/capabilityHelper.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/checkUploaded.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/config.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/constants.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/downloadBuildStacktrace.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/fileHelpers.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/getInitialDetails.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/hashUtil.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/logger.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/package-diff.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/packageInstaller.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/reporterHTML.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/sync/failedSpecsDetails.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/sync/specsSummary.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/sync/syncSpecsLogs.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/syncRunner.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/timeComponents.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/usageReporting.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/utils.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/zipUpload.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/runner.js","/Users/archish/browserstack/browserstack-cypress-cli/bin/templates/configTemplate.js"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","pid":96861,"argv":["/Users/archish/.nvm/versions/node/v12.18.3/bin/node","/Users/archish/.nvm/versions/node/v12.18.3/bin/npm","--version"],"execArgv":[],"cwd":"/Users/archish/browserstack/browserstack-cypress-cli","time":1675924395112,"ppid":96762,"coverageFilename":"/Users/archish/browserstack/browserstack-cypress-cli/.nyc_output/79dc2aeb-d682-45b3-8430-eea8b886e5ae.json","externalId":"","uuid":"79dc2aeb-d682-45b3-8430-eea8b886e5ae","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"processes":{"2807648c-3b13-4cd1-b949-11ce1b846277":{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","children":[]},"48e04c5a-5723-4547-b9d6-20074786acab":{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","children":[]},"51e8de95-1005-492b-8e2f-d7c6fc9148e4":{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","children":[]},"577e3334-ad22-4b05-ac7f-e0038582bb25":{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","children":[]},"59cc8cf4-849a-4cb5-bc52-0133091e0584":{"parent":null,"children":["2807648c-3b13-4cd1-b949-11ce1b846277","48e04c5a-5723-4547-b9d6-20074786acab","51e8de95-1005-492b-8e2f-d7c6fc9148e4","577e3334-ad22-4b05-ac7f-e0038582bb25","5fc28c76-8c92-44e9-9bae-ec2e85892509","5fffbcf8-4572-45c7-948f-38aeb3421a3e","6b02b68b-ad99-40ff-b34f-218d98a9c773","6ec27c2e-3529-412c-a82b-d1b8970a52a5","79dc2aeb-d682-45b3-8430-eea8b886e5ae"]},"5fc28c76-8c92-44e9-9bae-ec2e85892509":{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","children":[]},"5fffbcf8-4572-45c7-948f-38aeb3421a3e":{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","children":[]},"6b02b68b-ad99-40ff-b34f-218d98a9c773":{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","children":[]},"6ec27c2e-3529-412c-a82b-d1b8970a52a5":{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","children":[]},"7540c691-20e7-4eb9-a21e-75f1b22fe6eb":{"parent":null,"children":[]},"79dc2aeb-d682-45b3-8430-eea8b886e5ae":{"parent":"59cc8cf4-849a-4cb5-bc52-0133091e0584","children":[]}},"files":{"/Users/archish/browserstack/browserstack-cypress-cli/bin/runner.js":["2807648c-3b13-4cd1-b949-11ce1b846277","6ec27c2e-3529-412c-a82b-d1b8970a52a5","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/logger.js":["2807648c-3b13-4cd1-b949-11ce1b846277","59cc8cf4-849a-4cb5-bc52-0133091e0584","6ec27c2e-3529-412c-a82b-d1b8970a52a5","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/constants.js":["2807648c-3b13-4cd1-b949-11ce1b846277","59cc8cf4-849a-4cb5-bc52-0133091e0584","6ec27c2e-3529-412c-a82b-d1b8970a52a5","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/config.js":["2807648c-3b13-4cd1-b949-11ce1b846277","59cc8cf4-849a-4cb5-bc52-0133091e0584","6ec27c2e-3529-412c-a82b-d1b8970a52a5","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/buildArtifacts.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/utils.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/usageReporting.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/fileHelpers.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/init.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/capabilityHelper.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/getInitialDetails.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/hashUtil.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/packageInstaller.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/sync/failedSpecsDetails.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/sync/specsSummary.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/sync/syncSpecsLogs.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/timeComponents.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/zipUpload.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/generateDownloads.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/generateReport.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/info.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/templates/configTemplate.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/runs.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/archiver.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/build.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/syncRunner.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/checkUploaded.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/reporterHTML.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/downloadBuildStacktrace.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/helpers/package-diff.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"],"/Users/archish/browserstack/browserstack-cypress-cli/bin/commands/stop.js":["59cc8cf4-849a-4cb5-bc52-0133091e0584","7540c691-20e7-4eb9-a21e-75f1b22fe6eb"]},"externalIds":{}}
|
package/bin/commands/runs.js
CHANGED
|
@@ -69,7 +69,7 @@ module.exports = function run(args, rawArgs) {
|
|
|
69
69
|
// set cypress geo location
|
|
70
70
|
utils.setGeolocation(bsConfig, args);
|
|
71
71
|
|
|
72
|
-
// set spec timeout
|
|
72
|
+
// set spec timeout
|
|
73
73
|
utils.setSpecTimeout(bsConfig, args);
|
|
74
74
|
|
|
75
75
|
// accept the specs list from command line if provided
|
|
@@ -84,6 +84,9 @@ module.exports = function run(args, rawArgs) {
|
|
|
84
84
|
//accept the local from env variable if provided
|
|
85
85
|
utils.setLocal(bsConfig, args);
|
|
86
86
|
|
|
87
|
+
//set network logs
|
|
88
|
+
utils.setNetworkLogs(bsConfig);
|
|
89
|
+
|
|
87
90
|
// set Local Mode (on-demand/ always-on)
|
|
88
91
|
utils.setLocalMode(bsConfig, args);
|
|
89
92
|
|
|
@@ -99,8 +102,10 @@ module.exports = function run(args, rawArgs) {
|
|
|
99
102
|
// set the no-wrap
|
|
100
103
|
utils.setNoWrap(bsConfig, args);
|
|
101
104
|
|
|
102
|
-
//
|
|
103
|
-
utils.
|
|
105
|
+
// add cypress dependency if missing
|
|
106
|
+
utils.setCypressNpmDependency(bsConfig);
|
|
107
|
+
|
|
108
|
+
const { packagesInstalled } = await packageInstaller.packageSetupAndInstaller(bsConfig, config.packageDirName, {markBlockStart, markBlockEnd});
|
|
104
109
|
|
|
105
110
|
// set build tag caps
|
|
106
111
|
utils.setBuildTags(bsConfig, args);
|
|
@@ -129,8 +134,11 @@ module.exports = function run(args, rawArgs) {
|
|
|
129
134
|
logger.debug("Completed configs validation");
|
|
130
135
|
markBlockStart('preArchiveSteps');
|
|
131
136
|
logger.debug("Started pre-archive steps");
|
|
137
|
+
|
|
132
138
|
//get the number of spec files
|
|
139
|
+
markBlockStart('getNumberOfSpecFiles');
|
|
133
140
|
let specFiles = utils.getNumberOfSpecFiles(bsConfig, args, cypressConfigFile);
|
|
141
|
+
markBlockEnd('getNumberOfSpecFiles');
|
|
134
142
|
|
|
135
143
|
bsConfig['run_settings']['video_config'] = utils.getVideoConfig(cypressConfigFile);
|
|
136
144
|
|
|
@@ -140,6 +148,9 @@ module.exports = function run(args, rawArgs) {
|
|
|
140
148
|
// accept the number of parallels
|
|
141
149
|
utils.setParallels(bsConfig, args, specFiles.length);
|
|
142
150
|
|
|
151
|
+
// set record feature caps
|
|
152
|
+
utils.setRecordCaps(bsConfig, args, cypressConfigFile);
|
|
153
|
+
|
|
143
154
|
// warn if specFiles cross our limit
|
|
144
155
|
utils.warnSpecLimit(bsConfig, args, specFiles, rawArgs, buildReportData);
|
|
145
156
|
markBlockEnd('preArchiveSteps');
|
|
@@ -153,7 +164,7 @@ module.exports = function run(args, rawArgs) {
|
|
|
153
164
|
|
|
154
165
|
logger.debug("Started caching npm dependencies.");
|
|
155
166
|
markBlockStart('zip.packageInstaller');
|
|
156
|
-
return packageInstaller.packageWrapper(bsConfig, config.packageDirName, config.packageFileName, md5data, {markBlockStart, markBlockEnd}).then(function (packageData) {
|
|
167
|
+
return packageInstaller.packageWrapper(bsConfig, config.packageDirName, config.packageFileName, md5data, {markBlockStart, markBlockEnd}, packagesInstalled).then(function (packageData) {
|
|
157
168
|
logger.debug("Completed caching npm dependencies.")
|
|
158
169
|
markBlockEnd('zip.packageInstaller');
|
|
159
170
|
|
|
@@ -409,8 +420,8 @@ module.exports = function run(args, rawArgs) {
|
|
|
409
420
|
updateCheckInterval: 1000 * 60 * 60 * 24 * 7,
|
|
410
421
|
});
|
|
411
422
|
|
|
412
|
-
// Checks for update on first run.
|
|
413
|
-
// Set lastUpdateCheck to 0 to spawn the check update process as notifier sets this to Date.now() for preventing
|
|
423
|
+
// Checks for update on first run.
|
|
424
|
+
// Set lastUpdateCheck to 0 to spawn the check update process as notifier sets this to Date.now() for preventing
|
|
414
425
|
// the check untill one interval period. It runs once.
|
|
415
426
|
if (!notifier.disabled && Date.now() - notifier.config.get('lastUpdateCheck') < 50) {
|
|
416
427
|
notifier.config.set('lastUpdateCheck', 0);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const fs = require('fs'),
|
|
2
2
|
path = require('path');
|
|
3
|
+
const { readCypressConfigFile } = require('./readCypressConfigUtil');
|
|
3
4
|
|
|
4
5
|
const logger = require("./logger").winstonLogger,
|
|
5
6
|
Constants = require("./constants"),
|
|
@@ -194,34 +195,30 @@ const validate = (bsConfig, args) => {
|
|
|
194
195
|
logger.debug(`Checking for cypress config file at ${cypressConfigFilePath}`);
|
|
195
196
|
if (!fs.existsSync(cypressConfigFilePath) && bsConfig.run_settings.cypress_config_filename !== 'false') reject(Constants.validationMessages.INVALID_CYPRESS_CONFIG_FILE);
|
|
196
197
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (bsConfig.run_settings.cypressTestSuiteType === Constants.CYPRESS_V10_AND_ABOVE_TYPE) {
|
|
206
|
-
if (cypressConfigFilePath.endsWith("cypress.config.js")) {
|
|
207
|
-
cypressConfigFile = require(cypressConfigFilePath);
|
|
208
|
-
} else {
|
|
209
|
-
cypressConfigFile = {};
|
|
210
|
-
}
|
|
211
|
-
} else {
|
|
212
|
-
let cypressJsonContent = fs.readFileSync(cypressConfigFilePath);
|
|
213
|
-
cypressConfigFile = JSON.parse(cypressJsonContent);
|
|
198
|
+
logger.debug(`Validating ${bsConfig.run_settings.cypress_config_filename}`);
|
|
199
|
+
try {
|
|
200
|
+
if (bsConfig.run_settings.cypress_config_filename !== 'false') {
|
|
201
|
+
if (bsConfig.run_settings.cypressTestSuiteType === Constants.CYPRESS_V10_AND_ABOVE_TYPE) {
|
|
202
|
+
const completeCypressConfigFile = readCypressConfigFile(bsConfig)
|
|
203
|
+
if (!Utils.isUndefined(completeCypressConfigFile)) {
|
|
204
|
+
// check if cypress config was exported using export default
|
|
205
|
+
cypressConfigFile = !Utils.isUndefined(completeCypressConfigFile.default) ? completeCypressConfigFile.default : completeCypressConfigFile
|
|
214
206
|
}
|
|
215
207
|
|
|
216
|
-
//
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (!Utils.isUndefined(cypressConfigFile.integrationFolder) && !Utils.isCypressProjDirValid(bsConfig.run_settings.cypressProjectDir,cypressConfigFile.integrationFolder)) reject(Constants.validationMessages.INCORRECT_DIRECTORY_STRUCTURE);
|
|
208
|
+
// TODO: add validations for cypress_config_filename
|
|
209
|
+
} else {
|
|
210
|
+
let cypressJsonContent = fs.readFileSync(cypressConfigFilePath);
|
|
211
|
+
cypressConfigFile = JSON.parse(cypressJsonContent);
|
|
221
212
|
}
|
|
222
|
-
|
|
223
|
-
|
|
213
|
+
|
|
214
|
+
// Cypress Json Base Url & Local true check
|
|
215
|
+
if (!Utils.isUndefined(cypressConfigFile.baseUrl) && cypressConfigFile.baseUrl.includes("localhost") && !Utils.getLocalFlag(bsConfig.connection_settings)) reject(Constants.validationMessages.LOCAL_NOT_SET.replace("<baseUrlValue>", cypressConfigFile.baseUrl));
|
|
216
|
+
|
|
217
|
+
// Detect if the user is not using the right directory structure, and throw an error
|
|
218
|
+
if (!Utils.isUndefined(cypressConfigFile.integrationFolder) && !Utils.isCypressProjDirValid(bsConfig.run_settings.cypressProjectDir,cypressConfigFile.integrationFolder)) reject(Constants.validationMessages.INCORRECT_DIRECTORY_STRUCTURE);
|
|
224
219
|
}
|
|
220
|
+
} catch(error){
|
|
221
|
+
reject(Constants.validationMessages.INVALID_CYPRESS_JSON)
|
|
225
222
|
}
|
|
226
223
|
|
|
227
224
|
//check if home_directory is present or not in user run_settings
|
|
@@ -289,6 +286,9 @@ const validate = (bsConfig, args) => {
|
|
|
289
286
|
if (!Utils.isUndefined(bsConfig.run_settings.nodeVersion) && typeof(bsConfig.run_settings.nodeVersion) === 'string' && !bsConfig.run_settings.nodeVersion.match(/^(\d+\.)?(\d+\.)?(\*|\d+)$/))
|
|
290
287
|
logger.warn(Constants.validationMessages.NODE_VERSION_PARSING_ERROR);
|
|
291
288
|
|
|
289
|
+
if(!Utils.isUndefined(cypressConfigFile.port)) {
|
|
290
|
+
logger.warn(Constants.userMessages.CYPRESS_PORT_WARNING.replace("<x>", cypressConfigFile.port));
|
|
291
|
+
}
|
|
292
292
|
resolve(cypressConfigFile);
|
|
293
293
|
});
|
|
294
294
|
}
|
|
@@ -86,7 +86,7 @@ const checkUploadedMd5 = (bsConfig, args, instrumentBlocks) => {
|
|
|
86
86
|
zipUrlPresent: false,
|
|
87
87
|
packageUrlPresent: false,
|
|
88
88
|
};
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
if (args["force-upload"]) {
|
|
91
91
|
logger.debug("force-upload set to true. Uploading tests and npm packages.");
|
|
92
92
|
return resolve(obj);
|
package/bin/helpers/config.js
CHANGED
|
@@ -24,5 +24,7 @@ config.packageFileName = "bstackPackages.tar.gz";
|
|
|
24
24
|
config.packageDirName = "tmpBstackPackages";
|
|
25
25
|
config.retries = 5;
|
|
26
26
|
config.networkErrorExitCode = 2;
|
|
27
|
+
config.compiledConfigJsDirName = 'tmpBstackCompiledJs'
|
|
28
|
+
config.configJsonFileName = 'tmpCypressConfig.json'
|
|
27
29
|
|
|
28
30
|
module.exports = config;
|
package/bin/helpers/constants.js
CHANGED
|
@@ -43,8 +43,10 @@ const userMessages = {
|
|
|
43
43
|
"There was some issue while checking if zip is already uploaded.",
|
|
44
44
|
ZIP_DELETE_FAILED: "Could not delete tests.zip successfully.",
|
|
45
45
|
ZIP_DELETED: "Deleted tests.zip successfully.",
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
NPM_INSTALL:
|
|
47
|
+
"Installing required dependencies",
|
|
48
|
+
NPM_UPLOAD:
|
|
49
|
+
"Building the package to upload to BrowserStack",
|
|
48
50
|
NPM_DELETE_FAILED: "Could not delete the dependency packages.",
|
|
49
51
|
NPM_DELETED: "Deleted dependency packages successfully.",
|
|
50
52
|
API_DEPRECATED:
|
|
@@ -111,7 +113,9 @@ const userMessages = {
|
|
|
111
113
|
SPEC_LIMIT_SUCCESS_MESSAGE:
|
|
112
114
|
"Spec timeout specified as <x> minutes. If any of your specs exceed the specified time limit, it would be forcibly killed by BrowserStack",
|
|
113
115
|
NO_CONNECTION_WHILE_UPDATING_UPLOAD_PROGRESS_BAR:
|
|
114
|
-
"Unable to determine zip upload progress due to undefined/null connection request"
|
|
116
|
+
"Unable to determine zip upload progress due to undefined/null connection request",
|
|
117
|
+
CYPRESS_PORT_WARNING:
|
|
118
|
+
"The requested port number <x> is ignored. The default BrowserStack port will be used for this execution"
|
|
115
119
|
};
|
|
116
120
|
|
|
117
121
|
const validationMessages = {
|
|
@@ -310,9 +314,13 @@ const allowedFileTypes = [
|
|
|
310
314
|
"max",
|
|
311
315
|
"mjpeg",
|
|
312
316
|
"y4m",
|
|
317
|
+
"cjs",
|
|
318
|
+
"mjs",
|
|
313
319
|
"tsx",
|
|
314
320
|
"pfx",
|
|
315
321
|
"cfr",
|
|
322
|
+
"ico",
|
|
323
|
+
"html"
|
|
316
324
|
];
|
|
317
325
|
|
|
318
326
|
const filesToIgnoreWhileUploading = [
|
|
@@ -367,6 +375,7 @@ const packageInstallerOptions = {
|
|
|
367
375
|
const specFileTypes = ["js", "ts", "feature", "jsx", "coffee", "cjsx"];
|
|
368
376
|
|
|
369
377
|
const DEFAULT_CYPRESS_SPEC_PATH = "cypress/integration";
|
|
378
|
+
const DEFAULT_CYPRESS_10_SPEC_PATH = "cypress/e2e";
|
|
370
379
|
|
|
371
380
|
const SPEC_TOTAL_CHAR_LIMIT = 32243;
|
|
372
381
|
const METADATA_CHAR_BUFFER_PER_SPEC = 175;
|
|
@@ -419,6 +428,8 @@ const CYPRESS_CONFIG_FILE_MAPPING = {
|
|
|
419
428
|
|
|
420
429
|
const CYPRESS_CONFIG_FILE_NAMES = Object.keys(CYPRESS_CONFIG_FILE_MAPPING);
|
|
421
430
|
|
|
431
|
+
const CYPRESS_V10_AND_ABOVE_CONFIG_FILE_EXTENSIONS = ['js', 'ts', 'cjs', 'mjs']
|
|
432
|
+
|
|
422
433
|
module.exports = Object.freeze({
|
|
423
434
|
syncCLI,
|
|
424
435
|
userMessages,
|
|
@@ -432,6 +443,7 @@ module.exports = Object.freeze({
|
|
|
432
443
|
packageInstallerOptions,
|
|
433
444
|
specFileTypes,
|
|
434
445
|
DEFAULT_CYPRESS_SPEC_PATH,
|
|
446
|
+
DEFAULT_CYPRESS_10_SPEC_PATH,
|
|
435
447
|
SPEC_TOTAL_CHAR_LIMIT,
|
|
436
448
|
METADATA_CHAR_BUFFER_PER_SPEC,
|
|
437
449
|
usageReportingConstants,
|
|
@@ -448,5 +460,6 @@ module.exports = Object.freeze({
|
|
|
448
460
|
CYPRESS_V9_AND_OLDER_TYPE,
|
|
449
461
|
CYPRESS_V10_AND_ABOVE_TYPE,
|
|
450
462
|
CYPRESS_CONFIG_FILE_MAPPING,
|
|
451
|
-
CYPRESS_CONFIG_FILE_NAMES
|
|
463
|
+
CYPRESS_CONFIG_FILE_NAMES,
|
|
464
|
+
CYPRESS_V10_AND_ABOVE_CONFIG_FILE_EXTENSIONS
|
|
452
465
|
});
|
|
@@ -33,6 +33,9 @@ exports.getInitialDetails = (bsConfig, args, rawArgs) => {
|
|
|
33
33
|
utils.sendUsageReport(bsConfig, args, responseData["error"], Constants.messageTypes.ERROR, 'get_initial_details_failed', null, rawArgs);
|
|
34
34
|
resolve({});
|
|
35
35
|
} else {
|
|
36
|
+
if (!utils.isUndefined(responseData.grr) && responseData.grr.enabled && !utils.isUndefined(responseData.grr.urls)) {
|
|
37
|
+
config.uploadUrl = responseData.grr.urls.upload_url;
|
|
38
|
+
}
|
|
36
39
|
resolve(responseData);
|
|
37
40
|
}
|
|
38
41
|
}
|
|
@@ -128,16 +128,13 @@ const packageArchiver = (packageDir, packageFile) => {
|
|
|
128
128
|
})
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
const
|
|
131
|
+
const packageSetupAndInstaller = (bsConfig, packageDir, instrumentBlocks) => {
|
|
132
132
|
return new Promise(function (resolve) {
|
|
133
133
|
let obj = {
|
|
134
|
-
|
|
134
|
+
packagesInstalled: false
|
|
135
135
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return resolve(obj);
|
|
139
|
-
}
|
|
140
|
-
logger.info(Constants.userMessages.NPM_INSTALL_AND_UPLOAD);
|
|
136
|
+
|
|
137
|
+
logger.info(Constants.userMessages.NPM_INSTALL);
|
|
141
138
|
instrumentBlocks.markBlockStart("packageInstaller.folderSetup");
|
|
142
139
|
logger.debug("Started setting up package folder");
|
|
143
140
|
return setupPackageFolder(bsConfig.run_settings, packageDir).then((_result) => {
|
|
@@ -150,10 +147,34 @@ const packageWrapper = (bsConfig, packageDir, packageFile, md5data, instrumentBl
|
|
|
150
147
|
}).then((_result) => {
|
|
151
148
|
logger.debug("Completed installing dependencies");
|
|
152
149
|
instrumentBlocks.markBlockEnd("packageInstaller.packageInstall");
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
Object.assign(obj, { packagesInstalled: true });
|
|
151
|
+
return resolve(obj);
|
|
152
|
+
}).catch((err) => {
|
|
153
|
+
logger.warn(`Error occured while installing npm dependencies. Dependencies will be installed in runtime. This will have a negative impact on performance. Reach out to browserstack.com/contact, if you persistantly face this issue.`);
|
|
154
|
+
obj.error = err.stack ? err.stack.toString().substring(0,100) : err.toString().substring(0,100);
|
|
155
|
+
return resolve(obj);
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const packageWrapper = (bsConfig, packageDir, packageFile, md5data, instrumentBlocks, packagesInstalled) => {
|
|
161
|
+
return new Promise(function (resolve) {
|
|
162
|
+
let obj = {
|
|
163
|
+
packageArchieveCreated: false
|
|
164
|
+
};
|
|
165
|
+
if (!packagesInstalled) {
|
|
166
|
+
logger.debug("Skipping the caching of npm packages since package installed failed")
|
|
167
|
+
return resolve(obj);
|
|
168
|
+
}
|
|
169
|
+
if (md5data.packageUrlPresent || !utils.isTrueString(bsConfig.run_settings.cache_dependencies)) {
|
|
170
|
+
logger.debug("Skipping the caching of npm packages since BrowserStack has already cached your npm dependencies that have not changed since the last run.")
|
|
171
|
+
return resolve(obj);
|
|
172
|
+
}
|
|
173
|
+
logger.info(Constants.userMessages.NPM_UPLOAD);
|
|
174
|
+
instrumentBlocks.markBlockStart("packageInstaller.packageArchive");
|
|
175
|
+
logger.debug("Started archiving node_modules")
|
|
176
|
+
return packageArchiver(packageDir, packageFile)
|
|
177
|
+
.then((_result) => {
|
|
157
178
|
logger.debug("Archiving of node_modules completed");
|
|
158
179
|
instrumentBlocks.markBlockEnd("packageInstaller.packageArchive");
|
|
159
180
|
Object.assign(obj, { packageArchieveCreated: true });
|
|
@@ -167,3 +188,4 @@ const packageWrapper = (bsConfig, packageDir, packageFile, md5data, instrumentBl
|
|
|
167
188
|
}
|
|
168
189
|
|
|
169
190
|
exports.packageWrapper = packageWrapper;
|
|
191
|
+
exports.packageSetupAndInstaller = packageSetupAndInstaller;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const cp = require('child_process');
|
|
5
|
+
|
|
6
|
+
const config = require('./config');
|
|
7
|
+
const constants = require("./constants");
|
|
8
|
+
const utils = require("./utils");
|
|
9
|
+
const logger = require('./logger').winstonLogger;
|
|
10
|
+
|
|
11
|
+
exports.detectLanguage = (cypress_config_filename) => {
|
|
12
|
+
const extension = cypress_config_filename.split('.').pop()
|
|
13
|
+
return constants.CYPRESS_V10_AND_ABOVE_CONFIG_FILE_EXTENSIONS.includes(extension) ? extension : 'js'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.convertTsConfig = (bsConfig, cypress_config_filepath, bstack_node_modules_path) => {
|
|
17
|
+
const cypress_config_filename = bsConfig.run_settings.cypress_config_filename
|
|
18
|
+
const working_dir = path.dirname(cypress_config_filepath);
|
|
19
|
+
const complied_js_dir = path.join(working_dir, config.compiledConfigJsDirName)
|
|
20
|
+
if (fs.existsSync(complied_js_dir)) {
|
|
21
|
+
fs.rmdirSync(complied_js_dir, { recursive: true })
|
|
22
|
+
}
|
|
23
|
+
fs.mkdirSync(complied_js_dir, { recursive: true })
|
|
24
|
+
|
|
25
|
+
const typescript_path = path.join(bstack_node_modules_path, 'typescript', 'bin', 'tsc')
|
|
26
|
+
|
|
27
|
+
let tsc_command = `NODE_PATH=${bstack_node_modules_path} node "${typescript_path}" --outDir "${complied_js_dir}" --listEmittedFiles true --allowSyntheticDefaultImports --module commonjs --declaration false "${cypress_config_filepath}"`
|
|
28
|
+
|
|
29
|
+
if (/^win/.test(process.platform)) {
|
|
30
|
+
tsc_command = `set NODE_PATH=${bstack_node_modules_path}&& node "${typescript_path}" --outDir "${complied_js_dir}" --listEmittedFiles true --allowSyntheticDefaultImports --module commonjs --declaration false "${cypress_config_filepath}"`
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
let tsc_output
|
|
35
|
+
try {
|
|
36
|
+
logger.debug(`Running: ${tsc_command}`)
|
|
37
|
+
tsc_output = cp.execSync(tsc_command, { cwd: working_dir })
|
|
38
|
+
} catch (err) {
|
|
39
|
+
// error while compiling ts files
|
|
40
|
+
logger.debug(err.message);
|
|
41
|
+
logger.debug(err.output.toString());
|
|
42
|
+
tsc_output = err.output // if there is an error, tsc adds output of complilation to err.output key
|
|
43
|
+
} finally {
|
|
44
|
+
logger.debug(`Saved compiled js output at: ${complied_js_dir}`);
|
|
45
|
+
logger.debug(`Finding compiled cypress config file in: ${complied_js_dir}`);
|
|
46
|
+
|
|
47
|
+
const lines = tsc_output.toString().split('\n');
|
|
48
|
+
let foundLine = null;
|
|
49
|
+
for (let i = 0; i < lines.length; i++) {
|
|
50
|
+
if (lines[i].indexOf(`${path.parse(cypress_config_filename).name}.js`) > -1) {
|
|
51
|
+
foundLine = lines[i]
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (foundLine === null) {
|
|
56
|
+
logger.error(`No compiled cypress config found. There might some error running ${tsc_command} command`)
|
|
57
|
+
return null
|
|
58
|
+
} else {
|
|
59
|
+
const compiled_cypress_config_filepath = foundLine.split('TSFILE: ').pop()
|
|
60
|
+
logger.debug(`Found compiled cypress config file: ${compiled_cypress_config_filepath}`);
|
|
61
|
+
return compiled_cypress_config_filepath
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
exports.loadJsFile = (cypress_config_filepath, bstack_node_modules_path) => {
|
|
67
|
+
const require_module_helper_path = path.join(__dirname, 'requireModule.js')
|
|
68
|
+
let load_command = `NODE_PATH="${bstack_node_modules_path}" node "${require_module_helper_path}" "${cypress_config_filepath}"`
|
|
69
|
+
if (/^win/.test(process.platform)) {
|
|
70
|
+
load_command = `set NODE_PATH=${bstack_node_modules_path}&& node "${require_module_helper_path}" "${cypress_config_filepath}"`
|
|
71
|
+
}
|
|
72
|
+
logger.debug(`Running: ${load_command}`)
|
|
73
|
+
cp.execSync(load_command)
|
|
74
|
+
const cypress_config = JSON.parse(fs.readFileSync(config.configJsonFileName).toString())
|
|
75
|
+
if (fs.existsSync(config.configJsonFileName)) {
|
|
76
|
+
fs.unlinkSync(config.configJsonFileName)
|
|
77
|
+
}
|
|
78
|
+
return cypress_config
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
exports.readCypressConfigFile = (bsConfig) => {
|
|
82
|
+
const cypress_config_filepath = path.resolve(bsConfig.run_settings.cypressConfigFilePath)
|
|
83
|
+
try {
|
|
84
|
+
const cypress_config_filename = bsConfig.run_settings.cypress_config_filename
|
|
85
|
+
const bstack_node_modules_path = path.join(path.resolve(config.packageDirName), 'node_modules')
|
|
86
|
+
const conf_lang = this.detectLanguage(cypress_config_filename)
|
|
87
|
+
|
|
88
|
+
logger.debug(`cypress config path: ${cypress_config_filepath}`);
|
|
89
|
+
|
|
90
|
+
if (conf_lang == 'js' || conf_lang == 'cjs') {
|
|
91
|
+
return this.loadJsFile(cypress_config_filepath, bstack_node_modules_path)
|
|
92
|
+
} else if (conf_lang === 'ts') {
|
|
93
|
+
const compiled_cypress_config_filepath = this.convertTsConfig(bsConfig, cypress_config_filepath, bstack_node_modules_path)
|
|
94
|
+
return this.loadJsFile(compiled_cypress_config_filepath, bstack_node_modules_path)
|
|
95
|
+
}
|
|
96
|
+
} catch (error) {
|
|
97
|
+
const errorMessage = `Error while reading cypress config: ${error.message}`
|
|
98
|
+
const errorCode = 'cypress_config_file_read_failed'
|
|
99
|
+
logger.error(errorMessage)
|
|
100
|
+
utils.sendUsageReport(
|
|
101
|
+
bsConfig,
|
|
102
|
+
null,
|
|
103
|
+
errorMessage,
|
|
104
|
+
constants.messageTypes.WARNING,
|
|
105
|
+
errorCode,
|
|
106
|
+
null,
|
|
107
|
+
null
|
|
108
|
+
)
|
|
109
|
+
} finally {
|
|
110
|
+
const working_dir = path.dirname(cypress_config_filepath)
|
|
111
|
+
const complied_js_dir = path.join(working_dir, config.compiledConfigJsDirName)
|
|
112
|
+
if (fs.existsSync(complied_js_dir)) {
|
|
113
|
+
fs.rmdirSync(complied_js_dir, { recursive: true })
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// NOTE: DO NOT change the name or location of file, the execution of this file is invoked using fixed path
|
|
2
|
+
// helper file to load and read js modules
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const config = require('./config');
|
|
5
|
+
const moduleName = process.argv[2];
|
|
6
|
+
|
|
7
|
+
const mod = require(moduleName)
|
|
8
|
+
|
|
9
|
+
if (fs.existsSync(config.configJsonFileName)) {
|
|
10
|
+
fs.unlinkSync(config.configJsonFileName)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// write module in temporary json file
|
|
14
|
+
fs.writeFileSync(config.configJsonFileName, JSON.stringify(mod))
|